当前位置: 首页>>代码示例>>C++>>正文


C++ StringList::isEmpty方法代码示例

本文整理汇总了C++中StringList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::isEmpty方法的具体用法?C++ StringList::isEmpty怎么用?C++ StringList::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringList的用法示例。


在下文中一共展示了StringList::isEmpty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);

}
开发者ID:dmore,项目名称:sasquatch,代码行数:31,代码来源:id3v2framefactory.cpp

示例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);
}
开发者ID:mderezynski,项目名称:taglib-gio,代码行数:25,代码来源:id3v2framefactory.cpp

示例3:

StringList ID3v1::genreList()
{
  static StringList l;
  if(l.isEmpty()) {
    for(int i = 0; i < genresSize; i++)
      l.append(genres[i]);
  }
  return l;
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:9,代码来源:id3v1genres.cpp

示例4: setDescription

void UserTextIdentificationFrame::setDescription(const String &s)
{
    StringList l = fieldList();

    if(l.isEmpty())
        l.append(s);
    else
        l[0] = s;

    TextIdentificationFrame::setText(l);
}
开发者ID:gorilux,项目名称:sasquatch,代码行数:11,代码来源:textidentificationframe.cpp

示例5: fieldList

StringList UserTextIdentificationFrame::fieldList() const
{
  StringList l = TextIdentificationFrame::fieldList();

  if(!l.isEmpty()) {
    StringList::Iterator it = l.begin();
    l.erase(it);
  }

  return l;
}
开发者ID:elha,项目名称:CDex,代码行数:11,代码来源:textidentificationframe.cpp

示例6: if

PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
{
  static Map<String, String> reverseKeyMap;
  if(reverseKeyMap.isEmpty()) {
    int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]);
    for(int i = 0; i < numKeys; i++) {
      reverseKeyMap[keyTranslation[i][1]] = keyTranslation[i][0];
    }
  }

  PropertyMap origProps = properties();
  for(PropertyMap::ConstIterator it = origProps.begin(); it != origProps.end(); ++it) {
    if(!props.contains(it->first) || props[it->first].isEmpty()) {
      d->items.erase(reverseKeyMap[it->first]);
    }
  }

  PropertyMap ignoredProps;
  for(PropertyMap::ConstIterator it = props.begin(); it != props.end(); ++it) {
    if(reverseKeyMap.contains(it->first)) {
      String name = reverseKeyMap[it->first];
      if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && !it->second.isEmpty()) {
        StringList parts = StringList::split(it->second.front(), "/");
        if(!parts.isEmpty()) {
          int first = parts[0].toInt();
          int second = 0;
          if(parts.size() > 1) {
            second = parts[1].toInt();
          }
          d->items[name] = MP4::Item(first, second);
        }
      }
      else if((it->first == "BPM" || it->first == "MOVEMENTNUMBER" || it->first == "MOVEMENTCOUNT") && !it->second.isEmpty()) {
        int value = it->second.front().toInt();
        d->items[name] = MP4::Item(value);
      }
      else if((it->first == "COMPILATION" || it->first == "SHOWWORKMOVEMENT") && !it->second.isEmpty()) {
        bool value = (it->second.front().toInt() != 0);
        d->items[name] = MP4::Item(value);
      }
      else {
        d->items[name] = it->second;
      }
    }
    else {
      ignoredProps.insert(it->first, it->second);
    }
  }

  return ignoredProps;
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:51,代码来源:mp4tag.cpp

示例7: initStringListFromAttrs

// copy attrs into stringlist, returns true if list was modified
// if append is false, list is cleared first.
// if check_exist is true, items are only added if the are not already in the list. comparison is case-insensitive.
bool initStringListFromAttrs(StringList & list, bool append, const classad::References & attrs, bool check_exist /*=false*/)
{
    bool modified = false;
    if ( ! append) {
        if ( ! list.isEmpty()) {
            modified = true;
            list.clearAll();
        }
        check_exist = false; // no need to do this if we cleared the list
    }
    for (classad::References::const_iterator it = attrs.begin(); it != attrs.end(); ++it) {
        if (check_exist && list.contains_anycase(it->c_str())) {
            continue;
        }
        list.append(it->c_str());
        modified = true;
    }
    return modified;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例8: s


//.........这里部分代码省略.........

	//
	// Determine the CCB contact string, if any.
	//
	// Each group of routes which shared a broker index must be converted
	// back into the single original Sinful from which it sprang; that
	// Sinful can than be added to the ccbList with its CCB ID.
	//
	StringList ccbList;

	std::map< unsigned, std::string > brokerCCBIDs;
	std::map< unsigned, std::vector< SourceRoute > > brokers;
	for( unsigned i = 0; i < v.size(); ++i ) {
		if( v[i].getCCBID().empty() ) { continue; }

		SourceRoute sr = v[i];
		sr.setSharedPortID( sr.getCCBSharedPortID() );
		sr.setCCBSharedPortID( "" );
		sr.setCCBID( "" );

		unsigned brokerIndex = sr.getBrokerIndex();
		brokers[brokerIndex].push_back( sr );
		brokerCCBIDs[brokerIndex] = v[i].getCCBID();

		dprintf( D_ALWAYS, "broker %u = %s\n", brokerIndex, sr.serialize().c_str() );
	}

	for( unsigned i = 0; i < brokers.size(); ++i ) {
		std::string brokerV1String = "{";
		brokerV1String += brokers[i][0].serialize();
		for( unsigned j = 0; j < brokers[i].size(); ++j ) {
			brokerV1String += ", ";
			brokerV1String += brokers[i][j].serialize();
		}
		brokerV1String += "}";

		Sinful s( brokerV1String.c_str() );
		std::string ccbAddress = s.getCCBAddressString();
		CCBID ccbID;
		if(! CCBServer::CCBIDFromString( ccbID, brokerCCBIDs[i].c_str() )) {
			m_valid = false;
			return;
		}
		MyString ccbContactString;
		CCBServer::CCBIDToContactString( ccbAddress.c_str(), ccbID, ccbContactString );
		ccbList.append( ccbContactString.c_str() );
	}

	if(! ccbList.isEmpty() ) {
		char * ccbID = ccbList.print_to_delimed_string( " " );
		ASSERT( ccbID != NULL );
		setCCBContact( ccbID );
		free( ccbID );
	}

	// Determine the set of public addresses.
	for( unsigned i = 0; i < v.size(); ++i ) {
		if( v[i].getProtocol() == CP_PRIMARY ) { continue; }
		if(! v[i].getCCBID().empty()) { continue; }

		if( v[i].getNetworkName() == PUBLIC_NETWORK_NAME ) {
			addAddrToAddrs( v[i].getSockAddr() );
		}
	}

	// Determine the private network address, if any.
	for( unsigned i = 0; i < v.size(); ++i ) {
		if(! v[i].getCCBID().empty()) { continue; }
		if( v[i].getNetworkName() == PUBLIC_NETWORK_NAME ) { continue; }

		// A route with a public address may have a private network name
		// as a result of bypassing CCB.  Those addresses are not private
		// addresses, so ignore them.
		condor_sockaddr sa = v[i].getSockAddr();
		if( std::find( addrs.begin(), addrs.end(), sa ) != addrs.end() ) {
			continue;
		}

		// There can be only one private address.
		if( getPrivateAddr() != NULL ) {
			m_valid = false;
			return;
		}

		// setPrivateAddr( Sinful::privateAddressString( v[i].getSockAddr(), getSharedPortID() ).c_str() );
		Sinful p( v[i].getSockAddr().to_ip_and_port_string().c_str() );
		p.setSharedPortID( getSharedPortID() );
		setPrivateAddr( p.getSinful() );
	}

	// Set noUDP if any route sets it.
	for( unsigned i = 0; i < v.size(); ++i ) {
		if( v[i].getNoUDP() ) {
			setNoUDP( true );
			break;
		}
	}

	m_valid = true;
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:101,代码来源:condor_sinful.cpp

示例9: setPPstyle


//.........这里部分代码省略.........
		printf ("----------\n");
	}

	secondPass (argc, argv);

	// initialize the totals object
	if (ppStyle == PP_CUSTOM && using_print_format) {
		if (pmHeadFoot & HF_NOSUMMARY) ppTotalStyle = PP_CUSTOM;
	} else {
		ppTotalStyle = ppStyle;
	}
	TrackTotals	totals(ppTotalStyle);

	// fetch the query
	QueryResult q;

	if ((mode == MODE_STARTD_NORMAL) && (ppStyle == PP_STARTD_NORMAL)) {
		projList.AppendArg("Name");
		projList.AppendArg("Machine");
		projList.AppendArg("Opsys");
		projList.AppendArg("Arch");
		projList.AppendArg("State");
		projList.AppendArg("Activity");
		projList.AppendArg("LoadAvg");
		projList.AppendArg("Memory");
		projList.AppendArg("ActvtyTime");
		projList.AppendArg("MyCurrentTime");
		projList.AppendArg("EnteredCurrentActivity");
	} else if( ppStyle == PP_VERBOSE ) {
	    // Remove everything from the projection list if we're displaying
	    // the "long form" of the ads.
	    projList.Clear();
		// but if -attributes was supplied, show only those attributes
		if ( ! dashAttributes.isEmpty()) {
			const char * s;
			dashAttributes.rewind();
			while ((s = dashAttributes.next())) {
				projList.AppendArg(s);
			}
		}
	}

	if( projList.Count() > 0 ) {
		char **attr_list = projList.GetStringArray();
		query->setDesiredAttrs(attr_list);
		deleteStringArray(attr_list);
	}

	// if diagnose was requested, just print the query ad
	if (diagnose) {
		ClassAd 	queryAd;

		// print diagnostic information about inferred internal state
		setMode ((Mode) 0, 0, NULL);
		setType (NULL, 0, NULL);
		setPPstyle ((ppOption) 0, 0, DEFAULT);
		printf ("----------\n");

		q = query->getQueryAd (queryAd);
		fPrintAd (stdout, queryAd);

		printf ("----------\n");
		fprintf (stderr, "Result of making query ad was:  %d\n", q);
		exit (1);
	}
开发者ID:zjmeixinyanzhi,项目名称:htcondor,代码行数:66,代码来源:status.cpp

示例10: comment


//.........这里部分代码省略.........
  d->properties.setInstrumentCount(instrumentCount);
  d->properties.setFlags(flags);
  d->properties.setTempo(tempo);
  d->properties.setBpmSpeed(bpmSpeed);

  seek(60 + headerSize);

  // read patterns:
  for(unsigned short i = 0; i < patternCount; ++ i) {
    READ_U32L_AS(patternHeaderLength);
    READ_ASSERT(patternHeaderLength >= 4);

    unsigned char  packingType = 0;
    unsigned short rowCount = 0;
    unsigned short dataSize = 0;
    StructReader pattern;
    pattern.byte(packingType).u16L(rowCount).u16L(dataSize);

    unsigned int count = pattern.read(*this, patternHeaderLength - 4U);
    READ_ASSERT(count == std::min(patternHeaderLength - 4U, (unsigned long)pattern.size()));

    seek(patternHeaderLength - (4 + count) + dataSize, Current);
  }

  StringList intrumentNames;
  StringList sampleNames;
  unsigned int sumSampleCount = 0;

  // read instruments:
  for(unsigned short i = 0; i < instrumentCount; ++ i) {
    READ_U32L_AS(instrumentHeaderSize);
    READ_ASSERT(instrumentHeaderSize >= 4);

    String instrumentName;
    unsigned char  instrumentType = 0;
    unsigned short sampleCount = 0;

    StructReader instrument;
    instrument.string(instrumentName, 22).byte(instrumentType).u16L(sampleCount);

    // 4 for instrumentHeaderSize
    unsigned int count = 4 + instrument.read(*this, instrumentHeaderSize - 4U);
    READ_ASSERT(count == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4));

    unsigned long sampleHeaderSize = 0;
    long offset = 0;
    if(sampleCount > 0) {
      sumSampleCount += sampleCount;
      // wouldn't know which header size to assume otherwise:
      READ_ASSERT(instrumentHeaderSize >= count + 4 && readU32L(sampleHeaderSize));
      // skip unhandeled header proportion:
      seek(instrumentHeaderSize - count - 4, Current);

      for(unsigned short j = 0; j < sampleCount; ++ j) {
        unsigned long sampleLength = 0;
        unsigned long loopStart    = 0;
        unsigned long loopLength   = 0;
        unsigned char volume       = 0;
        unsigned char finetune     = 0;
        unsigned char sampleType   = 0;
        unsigned char panning      = 0;
        unsigned char noteNumber   = 0;
        unsigned char compression  = 0;
        String sampleName;
        StructReader sample;
        sample.u32L(sampleLength)
              .u32L(loopStart)
              .u32L(loopLength)
              .byte(volume)
              .byte(finetune)
              .byte(sampleType)
              .byte(panning)
              .byte(noteNumber)
              .byte(compression)
              .string(sampleName, 22);

        unsigned int count = sample.read(*this, sampleHeaderSize);
        READ_ASSERT(count == std::min(sampleHeaderSize, (unsigned long)sample.size()));
        // skip unhandeled header proportion:
        seek(sampleHeaderSize - count, Current);

        offset += sampleLength;
        sampleNames.append(sampleName);
      }
    }
    else {
      offset = instrumentHeaderSize - count;
    }
    intrumentNames.append(instrumentName);
    seek(offset, Current);
  }

  d->properties.setSampleCount(sumSampleCount);
  String comment(intrumentNames.toString("\n"));
  if(!sampleNames.isEmpty()) {
    comment += "\n";
    comment += sampleNames.toString("\n");
  }
  d->tag.setComment(comment);
}
开发者ID:pdgendt,项目名称:taglib,代码行数:101,代码来源:xmfile.cpp


注:本文中的StringList::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。