本文整理汇总了C++中StringList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::append方法的具体用法?C++ StringList::append怎么用?C++ StringList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: properties
PropertyMap Mod::Tag::setProperties(const PropertyMap &origProps)
{
PropertyMap properties(origProps);
properties.removeEmpty();
StringList oneValueSet;
if(properties.contains("TITLE")) {
d->title = properties["TITLE"].front();
oneValueSet.append("TITLE");
} else
d->title = String::null;
if(properties.contains("COMMENT")) {
d->comment = properties["COMMENT"].front();
oneValueSet.append("COMMENT");
} else
d->comment = String::null;
if(properties.contains("TRACKERNAME")) {
d->trackerName = properties["TRACKERNAME"].front();
oneValueSet.append("TRACKERNAME");
} else
d->trackerName = String::null;
// for each tag that has been set above, remove the first entry in the corresponding
// value list. The others will be returned as unsupported by this format.
for(StringList::Iterator it = oneValueSet.begin(); it != oneValueSet.end(); ++it) {
if(properties[*it].size() == 1)
properties.erase(*it);
else
properties[*it].erase( properties[*it].begin() );
}
return properties;
}
示例2: updateGenre
void FrameFactory::updateGenre(TextIdentificationFrame *frame) const
{
StringList fields;
String s = frame->toString();
while(s.startsWith("(")) {
int closing = s.find(")");
if(closing < 0)
break;
fields.append(s.substr(1, closing - 1));
s = s.substr(closing + 1);
}
if(!s.isEmpty())
fields.append(s);
if(fields.isEmpty())
fields.append(String::null);
frame->setText(fields);
}
示例3: updateGenre
void FrameFactory::updateGenre(TextIdentificationFrame *frame) const
{
StringList fields = frame->fieldList();
StringList newfields;
for(StringList::Iterator it = fields.begin(); it != fields.end(); ++it) {
String s = *it;
int end = s.find(")");
if(s.startsWith("(") && end > 0) {
// "(12)Genre"
String text = s.substr(end + 1);
bool ok;
int number = s.substr(1, end - 1).toInt(&ok);
if(ok && number >= 0 && number <= 255 && !(ID3v1::genre(number) == text))
newfields.append(s.substr(1, end - 1));
if(!text.isEmpty())
newfields.append(text);
}
else {
// "Genre" or "12"
newfields.append(s);
}
}
if(newfields.isEmpty())
fields.append(String::null);
frame->setText(newfields);
}
示例4: dir
// Return all suffix-matched files in the directory 'dirpath'
bool
suffix_matched_files_in_dir(const char *dirpath, StringList &file_list, const char *suffix, bool use_fullname)
{
Directory dir(dirpath);
bool found_it = false;
file_list.clearAll();
const char *f = NULL;
dir.Rewind();
while( (f=dir.Next()) ) {
if( dir.IsDirectory() ) {
continue;
}
if( has_suffix(f, suffix) ) {
if( use_fullname ) {
file_list.append(dir.GetFullPath());
}else {
file_list.append(f);
}
found_it = true;
}
}
return found_it;
}
示例5: toString
String AudioProperties::toString() const
{
StringList desc;
desc.append("Audio");
desc.append(String::number(length()) + " seconds");
desc.append(String::number(bitrate()) + " kbps");
return desc.toString(", ");
}
示例6: defaultFileExtensions
StringList FileRef::defaultFileExtensions()
{
StringList l;
l.append("ogg");
l.append("flac");
l.append("oga");
l.append("mp3");
l.append("mpc");
// l.append("wv");
// l.append("spx");
// l.append("tta");
l.append("m4a");
l.append("m4r");
l.append("m4b");
l.append("m4p");
l.append("3g2");
l.append("mp4");
l.append("wma");
l.append("asf");
// l.append("aif");
// l.append("aiff");
// l.append("wav");
l.append("ape");
// l.append("mod");
// l.append("module"); // alias for "mod"
// l.append("nst"); // alias for "mod"
// l.append("wow"); // alias for "mod"
// l.append("s3m");
// l.append("it");
// l.append("xm");
return l;
}
示例7: TextIdentificationFrame
TextIdentificationFrame *TextIdentificationFrame::createTIPLFrame(const PropertyMap &properties) // static
{
TextIdentificationFrame *frame = new TextIdentificationFrame("TIPL");
StringList l;
for(PropertyMap::ConstIterator it = properties.begin(); it != properties.end(); ++it){
l.append(it->first);
l.append(it->second.toString(",")); // comma-separated list of names
}
frame->setText(l);
return frame;
}
示例8: defaultFileExtensions
StringList FileRef::defaultFileExtensions()
{
StringList l;
l.append("ogg");
l.append("flac");
l.append("mp3");
l.append("mpc");
return l;
}
示例9: main
int main()
{
/* Hint 4:
* Since all c-string allocation is done in the main program
* we do not need any limits */
char word1[] = "Knüppel";
char word2[] = "Baum";
char word3[] = "Masche";
char word4[] = "Kreuz";
char word5[] = "XXX";
char word6[] = "Arabisch";
char word7[] = "Ball";
char word8[] = "Alaun";
biTree_t t;
t.insert(word1);
t.insert(word2);
t.insert(word3);
t.insert(word4);
t.insert(word5);
t.insert(word6);
t.insert(word7);
t.insert(word8);
t.print();
#ifdef VERBOSE
char checked_key1 = 'B';
char checked_key2 = 'X';
char searched_string1[] = "Alaun";
char searched_string2[] = "nix";
printf("Stringcount in key %c: %d\n", checked_key1, t.count(checked_key1));
printf("Stringcount in key %c: %d\n", checked_key2, t.count(checked_key2));
printf("String %s is in tree: %d\n", searched_string1, t.exists(searched_string1));
printf("String %s is in tree: %d\n", searched_string2, t.exists(searched_string2));
#endif
StringList sl;
sl.append(word1);
sl.append(word2);
sl.append(word3);
sl.print();
}
示例10: while
//------------------------------------------------------------
static void
writeTOC(BookCaseDB &db,
info_lib *mmdb,
const char *bcname,
const char *thisBook,
DBCursor &toc_cursor )
{
DBTable *out = db.DB::table(DATABASE_STDIO,
TOC_CODE, NUM_TOC_FIELDS,
DB::CREATE);
const char *aBook;
const char *nodeLoc;
const char *parent;
int childQty;
char **children;
int treeSize;
while(toc_cursor.next(STRING_CODE, &aBook,
STRING_CODE, &nodeLoc,
STRING_CODE, &parent,
SHORT_LIST_CODE, &childQty, STRING_CODE, &children,
INTEGER_CODE, &treeSize,
NULL)){
StringList heap;
if(strcmp(aBook, thisBook) != 0){ /* book id has changed! We're done... */
toc_cursor.undoNext();
break;
}
for(int i = 0; i < childQty; i++){
heap.append(to_oid(mmdb, bcname, children[i]));
}
const char *nodeOID = heap.append(to_oid(mmdb, bcname, nodeLoc));
const char *parentOID = heap.append(to_oid(mmdb, bcname, parent));
#ifdef FISH_DEBUG
DBUG_PRINT("TOC", ("TOC Entry: O:%s treesize: %d\n", nodeOID, treeSize));
#endif
out->insert(OID_CODE, nodeOID,
OID_CODE, parentOID,
INTEGER_CODE, treeSize,
/* first childQty strings in heap are oids for children */
OID_LIST_CODE, childQty, heap.array(),
NULL);
}
delete out;
}
示例11: split
StringList StringList::split(const String &s, const String &pattern)
{
StringList l;
int previousOffset = 0;
for(int offset = s.find(pattern); offset != -1; offset = s.find(pattern, offset + 1)) {
l.append(s.substr(previousOffset, offset - previousOffset));
previousOffset = offset + 1;
}
l.append(s.substr(previousOffset, s.size() - previousOffset));
return l;
}
示例12: callGahpFunction
int EC2GahpClient::ec2_spot_status_all( const std::string & service_url,
const std::string & publickeyfile,
const std::string & privatekeyfile,
StringList & returnStatus,
std::string & error_code )
{
static const char * command = "EC2_VM_STATUS_ALL_SPOT";
// callGahpFunction() checks if this command is supported.
CHECK_COMMON_ARGUMENTS;
Gahp_Args * result = NULL;
std::vector< YourString > arguments;
PUSH_COMMON_ARGUMENTS;
int cgf = callGahpFunction( command, arguments, result, high_prio );
if( cgf != 0 ) { return cgf; }
if( result ) {
// We expect results of the form
// <request ID> 0
// <request ID> 0 (<SIR ID> <status> <ami ID> <instance ID|NULL> <status code|NULL>)+
// <request ID> 1
// <request ID> 1 <error code> <error string>
if( result->argc < 2 ) { EXCEPT( "Bad %s result", command ); }
int rc = atoi( result->argv[1] );
if( result->argc == 2 ) {
if( rc == 1 ) { error_string = ""; }
} else if( result->argc == 4 ) {
if( rc != 1 ) { EXCEPT( "Bad %s result", command ); }
error_code = result->argv[2];
error_string = result->argv[3];
} else if( (result->argc - 2) % 5 == 0 ) {
for( int i = 2; i < result->argc; ++i ) {
if( strcmp( result->argv[i], NULLSTRING ) ) {
returnStatus.append( result->argv[i] );
} else {
returnStatus.append( "" );
}
}
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
} else {
EXCEPT( "callGahpFunction() succeeded but result was NULL." );
}
}
示例13: if
PropertyMap Ogg::XiphComment::setProperties(const PropertyMap &properties)
{
// check which keys are to be deleted
StringList toRemove;
for(FieldListMap::ConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it)
if (!properties.contains(it->first))
toRemove.append(it->first);
for(StringList::ConstIterator it = toRemove.begin(); it != toRemove.end(); ++it)
removeField(*it);
// now go through keys in \a properties and check that the values match those in the xiph comment
PropertyMap invalid;
PropertyMap::ConstIterator it = properties.begin();
for(; it != properties.end(); ++it)
{
if(!checkKey(it->first))
invalid.insert(it->first, it->second);
else if(!d->fieldListMap.contains(it->first) || !(it->second == d->fieldListMap[it->first])) {
const StringList &sl = it->second;
if(sl.size() == 0)
// zero size string list -> remove the tag with all values
removeField(it->first);
else {
// replace all strings in the list for the tag
StringList::ConstIterator valueIterator = sl.begin();
addField(it->first, *valueIterator, true);
++valueIterator;
for(; valueIterator != sl.end(); ++valueIterator)
addField(it->first, *valueIterator, false);
}
}
}
return invalid;
}
示例14: getStringTableIndex
// ============================================================================
//
// Potentially adds a string to the table and returns the index of it.
//
int getStringTableIndex (const String& a)
{
// Find a free slot in the table.
int idx;
for (idx = 0; idx < g_StringTable.size(); idx++)
{
// String is already in the table, thus return it.
if (g_StringTable[idx] == a)
return idx;
}
// Must not be too long.
if (a.length() >= gMaxStringLength)
error ("string `%1` too long (%2 characters, max is %3)\n",
a, a.length(), gMaxStringLength);
// Check if the table is already full
if (g_StringTable.size() == gMaxStringlistSize - 1)
error ("too many strings!\n");
// Now, dump the string into the slot
g_StringTable.append (a);
return (g_StringTable.size() - 1);
}
示例15: item
void
MP4::Tag::parseFreeForm(const MP4::Atom *atom)
{
AtomDataList data = parseData2(atom, -1, true);
if(data.size() > 2) {
String name = "----:" + String(data[0].data, String::UTF8) + ':' + String(data[1].data, String::UTF8);
AtomDataType type = data[2].type;
for(uint i = 2; i < data.size(); i++) {
if(data[i].type != type) {
debug("MP4: We currently don't support values with multiple types");
break;
}
}
if(type == TypeUTF8) {
StringList value;
for(uint i = 2; i < data.size(); i++) {
value.append(String(data[i].data, String::UTF8));
}
Item item(value);
item.setAtomDataType(type);
addItem(name, item);
}
else {
ByteVectorList value;
for(uint i = 2; i < data.size(); i++) {
value.append(data[i].data);
}
Item item(value);
item.setAtomDataType(type);
addItem(name, item);
}
}
}