Example #1
0
bool LDAPExpr::IsSimple(const StringList& keywords, LocalCache& cache,
                        bool matchCase ) const
{
  if (cache.empty())
  {
    cache.resize(keywords.size());
  }

  if (d->m_operator == EQ)
  {
    StringList::const_iterator index;
    if ((index = std::find(keywords.begin(), keywords.end(), matchCase ? d->m_attrName : ToLower(d->m_attrName))) != keywords.end() &&
        d->m_attrValue.find_first_of(LDAPExprConstants::WILDCARD()) == std::string::npos)
    {
      cache[index - keywords.begin()] = StringList(1, d->m_attrValue);
      return true;
    }
  }
  else if (d->m_operator == OR)
  {
    for (std::size_t i = 0; i < d->m_args.size( ); i++)
    {
      if (!d->m_args[i].IsSimple(keywords, cache, matchCase))
        return false;
    }
    return true;
  }
  return false;
}
Example #2
0
void SBWorkspace::findSchemes(const String& containerAbsPath) {
    if (containerAbsPath.empty()) {
        SBLog::error() << "No container specified for schemes." << std::endl;
        return;
    }

    StringList schemePaths;

    // Find all scheme files in the shareddata directory
    String sharedDir = joinPaths(containerAbsPath, "xcshareddata");
    if (fileExists(sharedDir))
        findFiles(sharedDir.c_str(), "*.xcscheme", DT_REG, true, schemePaths);

    String userDir = joinPaths(containerAbsPath, "xcuserdata");
#if !defined(_MSC_VER)
    // Only search the current user's data directory
    String user;
    sb_getenv("USER", user);
    userDir = joinPaths(userDir, user + ".xcuserdatad");
#endif

    // Find scheme files in the xcuserdata directory
    if (fileExists(userDir))
        findFiles(userDir.c_str(), "*.xcscheme", DT_REG, true, schemePaths);

    // Try to create a XCScheme out of each path
    StringList::iterator it = schemePaths.begin();
    StringList::iterator itEnd = schemePaths.end();
    for (; it != itEnd; it++) {
        XCScheme* scheme = XCScheme::createFromFile(*it, containerAbsPath);
        if (scheme) {
            m_schemes.push_back(scheme);
        }
    }
}
Example #3
0
static void trimAllQuotes(StringList &l)
{
	for(StringList::iterator it = l.begin(); it != l.end(); ++it)
    {
        trimQuotes(*it);
    }
}
Example #4
0
static const vector<string> StringListToVectorString(const StringList& stringList)
{
  vector<string> values;
  for (StringList::ConstIterator it = stringList.begin(); it != stringList.end(); ++it)
    values.push_back(it->to8Bit(true));
  return values;
}
Example #5
0
void Options::parsePluginStringData(const std::string &str, char separator1, char separator2)
{
    StringList valueList;

    split(str, valueList, separator1);
    if (valueList.size() > 0)
    {
        StringList keyAndValue;

        for (StringList::iterator itr = valueList.begin(); itr != valueList.end(); ++itr)
        {
            split(*itr, keyAndValue, separator2);
            if (keyAndValue.size() > 1)
            {
                setPluginStringData(keyAndValue.front(), keyAndValue.back());
            }
            else if (keyAndValue.size() > 0)
            {
                setPluginStringData(keyAndValue.front(), "true");
            }

            keyAndValue.clear();
        }
    }
}
string LdapTools::readStoragePoolUri(const string& storagePoolName) {
	string retval = "";
	string base("sstStoragePool=");
	base.append(storagePoolName).append(",ou=storage pools,ou=virtualization,ou=services,").append(
			Config::getInstance()->getLdapBaseDn());
	SYSLOGLOGGER(logDEBUG) << "readStoragePool " << base;
	LDAPSearchResults* entries = lc->search(base, LDAPConnection::SEARCH_SUB);
	if (entries != 0) {
		LDAPEntry* entry = entries->getNext();
		if (entry != 0) {
//			SYSLOGLOGGER(logINFO) << "dn: " << entry->getDN() << endl;
			const LDAPAttributeList* attrs = entry->getAttributes();
			LDAPAttributeList::const_iterator it = attrs->begin();
			for (; it != attrs->end(); it++) {
				LDAPAttribute attr = *it;
//				SYSLOGLOGGER(logINFO) << attr.getName() << "(";
//				SYSLOGLOGGER(logINFO) << attr.getNumValues() << "): ";
				if (0 == attr.getName().compare("sstStoragePoolURI")) {
					StringList values = attr.getValues();
					StringList::const_iterator it2 = values.begin();
					if (it2 != values.end()) {
						retval = *it2;
						break;
					}
				}
			}
			delete entry;
		}
	}
	return retval;
}
Example #7
0
static void validateConf(const string& datName)
{
#ifdef _DEBUG
	printf("validateConf: %s\n", datName.c_str());
#endif

	if (itemStateTable[datName] == 0)
		return;

	//iterate confTable
	list<StringList>::iterator iter = confTable.begin();
	for (; iter != confTable.end(); iter++) {
		StringList confList = *iter;

		//locate the confList we're interested in
		if (stringListContain(confList, datName)) {
			//uncheck items in the confList
			string conf;
			StringList::iterator it = confList.begin();
			for (; it != confList.end(); it++) {
				conf = *it;
				if (datName == conf)
					continue;

				if (itemStateTable[conf] == 1) {
					itemStateTable[conf] = 0;
#ifdef _DEBUG
					printf("auto unchk: %s\n", conf.c_str());
#endif
					validateDep(conf);
				}
			}
		}
	}
}
Example #8
0
static inline void lowerTrimmed(StringList& list)
{
	StringList::iterator iter = list.begin();
	for (; iter != list.end(); iter++) {
		lowerString(*iter);
	}
}
Example #9
0
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);

}
        virtual void handleMessage( const Message & msg, MessageSession * session)
        {
            m_messageEventFilter->raiseMessageEvent( MessageEventDisplayed );
            m_messageEventFilter->raiseMessageEvent( MessageEventComposing );
            m_chatStateFilter->setChatState( ChatStateComposing );
            
            //这里的消息命令。都是自己定义的,用来测试的
			//我在这里使用消息进行触发操作,并不代表这种操作就只能在消息中进行,
			//可以定义在任何的场景中
            //因为是消息机制,所以,用消息代表一个命令,发过来触发流程操作
            if( msg.body() == "test-buddylist" ) //遍历本地联系人列表
            {
                Roster * roster = j->rosterManager()->roster();
                Roster::const_iterator it = roster->begin();
                for( ; it != roster->end(); ++it )
                {
                    printf( "jid: %s, name: %s, subscription: %d\n", (*it).second->jidJID().full().c_str(), (*it).second->name().c_str(), (*it).second->subscription() );
                
                    StringList g = (*it).second->groups();
                    StringList::const_iterator it_g = g.begin();
                
                    for( ; it_g != g.end(); ++it_g )
                    {
                        printf( "\tgroup: %s\n", (*it_g).c_str() );
                    }
                
                    RosterItem::ResourceMap::const_iterator rit = (*it).second->resources().begin();
                    for( ; rit != (*it).second->resources().end(); ++rit )
                    {
                        printf( "resource: %s\n", (*rit).first.c_str() );
                    }
                }
            }
        }
Example #11
0
bool
Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
{
    //
    // Validate global metadata in the top-level file and all included files.
    //
    StringList files = p->allFiles();

    for(StringList::iterator q = files.begin(); q != files.end(); ++q)
    {
        string file = *q;
        DefinitionContextPtr dc = p->findDefinitionContext(file);
        assert(dc);
        StringList globalMetaData = dc->getMetaData();
        int headerDir = 0;
        for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
        {
            string s = *r;
            if(_history.count(s) == 0)
            {
                if(s.find(_objcPrefix) == 0)
                {
                    static const string objcHeaderDirPrefix = "objc:header-dir:";
                    if(s.find(objcHeaderDirPrefix) == 0 && s.size() > objcHeaderDirPrefix.size())
                    {
                        headerDir++;
                        if(headerDir > 1)
                        {
                            ostringstream ostr;
                            ostr << "ignoring invalid global metadata `" << s
                                 << "': directive can appear only once per file";
                            emitWarning(file, -1, ostr.str());
                            _history.insert(s);
                        }
                        continue;
                    }
                    ostringstream ostr;
                    ostr << "ignoring invalid global metadata `" << s << "'";
                    emitWarning(file, -1, ostr.str());
                }
                _history.insert(s);
            }
        }
    }

    return true;
}
void TypeRegistry::add_referenced_types(const std::string &decl, StringList &out) const
{
    TypeNameUtils::TokenList tokens;
    TypeNameUtils::tokenize(decl, tokens);
    for (TypeNameUtils::TokenList::const_iterator i=tokens.begin(); i!=tokens.end(); ++i)
    {
        if (i->type == TypeNameUtils::Token::IDENTIFIER)
        {
            std::string fn = getDeclaringFileName(decl.substr(i->beg, i->len));
            if (!fn.empty())
            {
                if (std::find(out.begin(), out.end(), fn) == out.end())
                    out.push_back(fn);
            }
        }
    }
}
Example #13
0
int GeneratorBase::set_generator_options(const StringList& options)
{
	for (StringList::const_iterator it = options.begin();
	     it != options.end(); ++it)
		if (!parse_option(*it))
			return EXIT_FAILURE;
	return EXIT_SUCCESS;
}
Example #14
0
void MP4::Tag::removeUnsupportedProperties(const StringList &props)
{
    StringList::ConstIterator it = props.begin();

    for ( ; it != props.end(); ++it ) {
        d->items.erase(*it);
    }
}
Example #15
0
ustring DataValue::serializeStrList(void *value) {
	ustring result("#");
	StringList list;
	list = *(ustring*)value;
	for(StringList::iterator line = list.begin(); line != list.end(); line++)
		result += int_to_str(line->size()) + ":" + *line + "|";
	return result;
}
bool CreateDefDirInodesMsgEx::processIncoming(struct sockaddr_in* fromAddr, Socket* sock,
   char* respBuf, size_t bufLen, HighResolutionStats* stats)
{
   std::string peer = fromAddr ? Socket::ipaddrToStr(&fromAddr->sin_addr) : sock->getPeername();
   LOG_DEBUG("CreateDefDirInodesMsg incoming", 4,
      std::string("Received a CreateDefDirInodesMsg from: ") + peer);

   LogContext log("CreateDefDirInodesMsg incoming");

   App* app = Program::getApp();
   Config* cfg = app->getConfig();
   uint16_t localNodeNumID = app->getLocalNode()->getNumID();

   StringList inodeIDs;
   StringList failedInodeIDs;
   FsckDirInodeList createdInodes;

   this->parseInodeIDs(&inodeIDs);

   for ( StringListIter iter = inodeIDs.begin(); iter != inodeIDs.end(); iter++ )
   {
      std::string inodeID = *iter;
      int mode = S_IFDIR | S_IRWXU;
      unsigned userID = 0; // root
      unsigned groupID = 0; // root
      uint16_t ownerNodeID = localNodeNumID;

      UInt16Vector stripeTargets;
      unsigned defaultChunkSize = cfg->getTuneDefaultChunkSize();
      unsigned defaultNumStripeTargets = cfg->getTuneDefaultNumStripeTargets();
      Raid0Pattern stripePattern(defaultChunkSize, stripeTargets, defaultNumStripeTargets);

      // we try to create a new directory inode, with default values
      DirInode dirInode(inodeID, mode, userID, groupID, ownerNodeID, stripePattern);
      if ( dirInode.storeAsReplacementFile(inodeID) == FhgfsOpsErr_SUCCESS )
      {
         // try to refresh the metainfo (maybe a .cont directory was already present)
         dirInode.refreshMetaInfo();

         StatData statData;
         dirInode.getStatData(statData);

         FsckDirInode fsckDirInode(inodeID, "", 0, localNodeNumID, statData.getFileSize(),
            statData.getNumHardlinks(), stripeTargets, FsckStripePatternType_RAID0, localNodeNumID);
         createdInodes.push_back(fsckDirInode);
      }
      else
         failedInodeIDs.push_back(inodeID);
   }

   CreateDefDirInodesRespMsg respMsg(&failedInodeIDs, &createdInodes);
   respMsg.serialize(respBuf, bufLen);
   sock->sendto(respBuf, respMsg.getMsgLength(), 0, (struct sockaddr*) fromAddr,
      sizeof(struct sockaddr_in));

   return true;

}
Example #17
0
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {

	std::string warnings;
	for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
		warnings +=  *i + ';';

	std::string definesList;
	for (StringList::const_iterator i = defines.begin(); i != defines.end(); ++i)
		definesList += *i + ';';

	// Add define to include revision header
	if (runBuildEvents)
		definesList += REVISION_DEFINE ";";

	properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
	              "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << (_version >= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
	              "\t<PropertyGroup>\n"
	              "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n"
	              "\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)</ExecutablePath>\n"
	              "\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
	              "\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(IncludePath)</IncludePath>\n"
	              "\t\t<OutDir>$(Configuration)" << bits << "\\</OutDir>\n"
	              "\t\t<IntDir>$(Configuration)" << bits << "/$(ProjectName)\\</IntDir>\n"
	              "\t</PropertyGroup>\n"
	              "\t<ItemDefinitionGroup>\n"
	              "\t\t<ClCompile>\n"
	              "\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n"
	              "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
	              "\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
	              "\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
	              "\t\t\t<ExceptionHandling>" << ((setup.devTools || setup.tests) ? "Sync" : "") << "</ExceptionHandling>\n";

#if NEEDS_RTTI
	properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n";
#else
	properties << "\t\t\t<RuntimeTypeInfo>false</RuntimeTypeInfo>\n";
#endif

	properties << "\t\t\t<WarningLevel>Level4</WarningLevel>\n"
	              "\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n"
	              "\t\t\t<CompileAs>Default</CompileAs>\n"
	              "\t\t</ClCompile>\n"
	              "\t\t<Link>\n"
	              "\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n"
	              "\t\t\t<SubSystem>Console</SubSystem>\n";

	if (!setup.devTools && !setup.tests)
		properties << "\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n";

	properties << "\t\t</Link>\n"
	              "\t\t<ResourceCompile>\n"
	              "\t\t\t<AdditionalIncludeDirectories>" << prefix << ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
	              "\t\t</ResourceCompile>\n"
	              "\t</ItemDefinitionGroup>\n"
	              "</Project>\n";

	properties.flush();
}
  String ConsoleUtils::breakString_(const OpenMS::String& input, const Size indentation, const Size max_lines)
  {

    // get the line length
    const Int line_len = ConsoleUtils::readConsoleSize_();

    StringList result;
    Size short_line_len = line_len - indentation;
    if (short_line_len < 1)
    {
      std::cerr << "INTERNAL ERROR: cannot split lines into empty strings! see breakString_()";
      return input;
    }
    for (Size i = 0; i < input.size(); )
    {
      String line = input.substr(i, result.size() == 0 ? line_len : short_line_len); // first line has full length
      Size advance_size = line.size();
      if (line.hasSubstring("\n"))
      {
        advance_size = 0;
        while (line.hasPrefix("\n"))
        {
          line = line.substr(1);
          ++advance_size;
        } // advance by # of \n's
        if (line.hasSubstring("\n")) line = line.prefix('\n');
        advance_size += line.size(); // + actual chars
      }

      // check if we are using the full length and split a word at the same time
      // cut a little earlier in that case for nicer looks
      if (line.size() ==  (result.size() == 0 ? line_len : short_line_len) && short_line_len > 8 && line.rfind(' ') != String::npos)
      {
        String last_word = line.suffix(' ');
        if (last_word.length() < 4)
        { // shorten by last word (will move to the next line)
          line = line.prefix(line.size() - last_word.length());
          advance_size -= last_word.size(); // + actual chars
        }
      }

      i += advance_size;
      String s_intend = (result.size() == 0 ? "" : String(indentation, ' ')); // first line no indentation
      String r = s_intend + (result.size() == 0 ? line : line.trim()); // intended lines get trimmed
      result.push_back(r); //(r.fillRight(' ', (UInt) line_len));
    }
    if (result.size() > max_lines) // remove lines from end if we get too many (but leave the last one)...
    {
      String last = result.back();
      result.erase(result.begin() + max_lines - 2, result.end());
      result.push_back((String(indentation, ' ') + String("..."))); //.fillRight(' ',(UInt) line_len));
      result.push_back(last);
    }
    // remove last " " from last line to prevent automatic linebreak
    //if (result.size()>0 && result[result.size()-1].hasSuffix(" ")) result[result.size()-1] = result[result.size()-1].substr(0,result[result.size()-1].size()-1);
    return ListUtils::concatenate(result, "\n");
  }
Example #19
0
int main( int argc, char ** argv )
{
    int nLibIndex = ParseArgs( argc, argv );
    if( nLibIndex == 0 )
        return -1;

    if( g_fDiag )
        Diags( argc, argv );

    Logger logger;
    GetLinuxPwd();
    for( ; nLibIndex < argc; nLibIndex++ )
    {
        StringList files = GetFileList( argv[nLibIndex] );
        for( StringList::const_iterator it=files.begin(); it!=files.end(); ++it )
        {
            std::string library = *it;

            std::cout << "Loading Library: " << library << std::endl;
            DllHandle hModule = LOAD_LIBRARY( library.c_str() );
            DLERROR_CHECK;

            if( !hModule )
            {
                std::cout<<"ERROR: Failed to load "<< *it << std::endl; 
                std::cout.flush(); 
                continue;
            }

            RunAllFn pRunAll = (RunAllFn)GET_PROC_ADDRESS( hModule, "RunAll" );
            if( pRunAll == NULL )
            {
                std::cerr << std::endl << "Function RunAll() not found in library " << library << "!" << std::endl;
                FREE_LIBRARY( hModule );
                continue;
            }
            pRunAll( &logger, g_configFileName.c_str() );
            
            FREE_LIBRARY( hModule );
        } // next library
    } // next arg

    if( g_fCSV )
    {
        try 
        {
            std::ofstream log(g_logPath.c_str());
            GenerateReportCSV( logger, log, g_fNoHeader );
        }
        catch(...)
        {
            std::cerr << "Error writing log file " << g_logPath << "!" << std::endl;
        }
    }
    
    std::cout << std::endl;
}
Example #20
0
bool IDEvaluationBase::loadFiles(const StringList& list)
{
    bool good = true;
    for (StringList::const_iterator it = list.begin(); it != list.end(); ++it)
    {
        if (!addSearchFile(*it)) good = false;
    }
    return good;
}
Example #21
0
void plainconf::loadDirectory(const char *pPath, const char *pPattern)
{
    DIR *pDir = opendir(pPath);

    if (!pDir)
    {
        logToMem(LOG_LEVEL_ERR, "Failed to open directory [%s].", pPath);
        return ;
    }

    struct dirent *dir_ent;

    char str[4096] = {0};
    strcpy(str, pPath);
    strcatchr(str, '/', 4096);
    int offset = strlen(str);
    StringList AllEntries;

    while ((dir_ent = readdir(pDir)))
    {
        const char *pName = dir_ent->d_name;

        if ((strcmp(pName, ".") == 0) ||
            (strcmp(pName, "..") == 0) ||
            (*(pName + strlen(pName) - 1) == '~'))
            continue;

        if (pPattern)
        {
            //Beside the unmatch, also must exclude *,v which was created by rcs
            if(fnmatch(pPattern, pName, FNM_PATHNAME) != 0
                || fnmatch("*,v", pName, FNM_PATHNAME) == 0)
                continue;
        }

        strcpy(str + offset, pName);
        struct stat st;
        if (stat(str, &st) == 0)
        {
            if (S_ISDIR(st.st_mode)
                || pPattern
                || fnmatch("*.conf", pName, FNM_PATHNAME) == 0)
                AllEntries.add(str);
        }
    }
    closedir(pDir);
    AllEntries.sort();

    StringList::iterator iter;
    for (iter = AllEntries.begin(); iter != AllEntries.end(); ++iter)
    {
        const char *pName = (*iter)->c_str();
        logToMem(LOG_LEVEL_INFO, "Processing config file: %s", pName);
        loadConfFile(pName);
    }
}
void LDAPSchema::setObjectClasses (const StringList &ocs) {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setObjectClasses()" << endl);
    
    // parse the stringlist and save it to global map...
    StringList::const_iterator i,j;
    for (i = ocs.begin(); i != ocs.end(); i++) {
	LDAPObjClass oc ( (*i) );
	StringList names = oc.getNames();
	// there could be more names for one object...
	for (j = names.begin(); j != names.end(); j++) {
            string lc_name = *j;
            string::iterator k;
            for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
                (*k) = tolower(*k); 
            }
	    object_classes [lc_name] = LDAPObjClass (oc);
	}
    }
}
Example #23
0
static StringList
fixIds(const StringList& ids)
{
    StringList newIds;
    for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
    {
        newIds.push_back(lookupKwd(*i));
    }
    return newIds;
}
Example #24
0
ByteVector
MP4::Tag::renderText(const ByteVector &name, const MP4::Item &item, int flags) const
{
  ByteVectorList data;
  StringList value = item.toStringList();
  for(StringList::ConstIterator it = value.begin(); it != value.end(); ++it) {
    data.append(it->data(String::UTF8));
  }
  return renderData(name, flags, data);
}
string PreprocessorFunctionIterator::ConcatToSingleString(const StringList& inStrings,const string& inSurroundingText)
{
	stringstream aStream;
	aStream<<inSurroundingText;
	StringList::const_iterator it = inStrings.begin();
	for(; it != inStrings.end();++it)
		aStream<<*it;					
	aStream<<inSurroundingText;
	return aStream.str();
}
PropertyMap UserTextIdentificationFrame::asProperties() const
{
  PropertyMap map;
  String tagName = txxxToKey(description());
  StringList v = fieldList();
  for(StringList::ConstIterator it = v.begin(); it != v.end(); ++it)
    if(it != v.begin())
      map.insert(tagName, *it);
  return map;
}
Example #27
0
bool Connector::abbr(const StringList& keylist, const std::string& data)
{
	StringList real_keylist;
	for (StringList::const_iterator it = keylist.begin();
	     it != keylist.end(); ++it) {		
		fill_key(*it);
		generate_keys(real_keylist);
	}
	return generator_.on_have_data(real_keylist, data);
}
Example #28
0
/** 
Function responsible to insert list of strings into Hash table

@internalComponent
@released

@param aString - String which needs to be inserted
*/
void HashTable::InsertStringList(StringList& aList)
{
	StringList::iterator beginIter = aList.begin();
	StringList::iterator endIter = aList.end();
	while(beginIter != endIter)
	{
		Insert((*beginIter));
		++beginIter;
	}
}
void LDAPSchema::setAttributeTypes (const StringList &ats) {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setAttributeTypes()" << endl);
    
    // parse the stringlist and save it to global map...
    StringList::const_iterator i,j;
    for (i = ats.begin(); i != ats.end(); i++) {
	LDAPAttrType at ( (*i) );
	StringList names = at.getNames();
	// there could be more names for one object...
	for (j = names.begin(); j != names.end(); j++) {
            string lc_name = *j;
            string::iterator k;
            for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
                (*k) = tolower(*k); 
            }
	    attr_types [lc_name] = LDAPAttrType (at);
	}
    }
}
Example #30
0
String ID3v2::Tag::genre() const
{
  // TODO: In the next major version (TagLib 2.0) a list of multiple genres
  // should be separated by " / " instead of " ".  For the moment to keep
  // the behavior the same as released versions it is being left with " ".

  if(d->frameListMap["TCON"].isEmpty() ||
     !dynamic_cast<TextIdentificationFrame *>(d->frameListMap["TCON"].front()))
  {
    return String::null;
  }

  // ID3v2.4 lists genres as the fields in its frames field list.  If the field
  // is simply a number it can be assumed that it is an ID3v1 genre number.
  // Here was assume that if an ID3v1 string is present that it should be
  // appended to the genre string.  Multiple fields will be appended as the
  // string is built.

  TextIdentificationFrame *f = static_cast<TextIdentificationFrame *>(
    d->frameListMap["TCON"].front());

  StringList fields = f->fieldList();

  StringList genres;

  for(StringList::Iterator it = fields.begin(); it != fields.end(); ++it) {

    if((*it).isEmpty())
      continue;

    bool ok;
    int number = (*it).toInt(&ok);
    if(ok && number >= 0 && number <= 255) {
      *it = ID3v1::genre(number);
    }

    if(std::find(genres.begin(), genres.end(), *it) == genres.end())
      genres.append(*it);
  }

  return genres.toString();
}