13
0

PBD::capitalize() and use it to for the XML node name of a SequenceProperty's history node

git-svn-id: svn://localhost/ardour2/branches/3.0@6719 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-03-02 01:05:14 +00:00
parent db8b575c30
commit a5ab2e99e1
4 changed files with 17 additions and 4 deletions

View File

@ -25,7 +25,6 @@
#include <string>
#include <climits>
#include "pbd/failed_constructor.h"
#include "pbd/stl_delete.h"
#include "pbd/xml++.h"
@ -2049,7 +2048,7 @@ Playlist::property_factory (const XMLNode& history_node) const
/* XXX property name needs capitalizing */
if ((*i)->name() == regions.property_name()) {
if ((*i)->name() == capitalize (regions.property_name())) {
RegionListProperty* rlp = new RegionListProperty (*const_cast<Playlist*> (this));

View File

@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <cstdio>
#include <ctype.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
@ -36,6 +37,17 @@ using Glib::ustring;
namespace PBD {
string
capitalize (const string& str)
{
string ret = str;
if (!str.empty()) {
/* XXX not unicode safe */
ret[0] = toupper (str[0]);
}
return ret;
}
string
short_version (string orig, string::size_type target_length)
{

View File

@ -38,6 +38,8 @@ double atof (const std::string&);
void url_decode (std::string&);
void url_decode (Glib::ustring&);
std::string capitalize (const std::string&);
// std::string length2string (const int32_t frames, const float sample_rate);
std::string length2string (const int64_t frames, const double sample_rate);

View File

@ -8,6 +8,7 @@
#include <boost/function.hpp>
#include "pbd/convert.h"
#include "pbd/id.h"
#include "pbd/property_basics.h"
@ -44,8 +45,7 @@ class SequenceProperty : public PropertyBase
void add_history_state (XMLNode* history_node) const {
/* XXX need to capitalize property name */
XMLNode* child = new XMLNode (property_name());
XMLNode* child = new XMLNode (PBD::capitalize (property_name()));
history_node->add_child_nocopy (*child);
/* record the change described in our change member */