CMS 3D CMS Logo

IgNameList.h

Go to the documentation of this file.
00001 #ifndef IGUANA_FRAMEWORK_IG_NAME_LIST_H
00002 # define IGUANA_FRAMEWORK_IG_NAME_LIST_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Framework/interface/config.h"
00007 # include <string>
00008 # include <list>
00009 
00010 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00011 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00012 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00014 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00015 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00016 
00018 typedef std::list<std::string>          IgNameList;
00019 
00021 typedef IgNameList::const_iterator      IgNameIterator;
00022 
00023 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00024 
00027 inline bool
00028 isNameList (const std::string &list)
00029 { return list.find_first_not_of (' ') != std::string::npos; }
00030 
00032 inline void
00033 splitNameList (IgNameList &to, const std::string &from)
00034 {
00035     std::string::size_type start = 0;
00036     std::string::size_type end;
00037     do {
00038         end = from.find_first_of (' ', start);
00039         to.push_back (from.substr (start, end));
00040         start = (end == std::string::npos ? end
00041                  : from.find_first_not_of (' ', end));
00042     } while (start != std::string::npos);
00043 }
00044 
00046 inline std::string
00047 makeNameList (const IgNameList &from)
00048 {
00049     IgNameIterator      name = from.begin ();
00050     std::string         result;
00051 
00052     while (true)
00053     {
00054         result.append (*name);
00055         if (++name == from.end ())
00056             break;
00057         result.append (1, ' ');
00058     }
00059     return result;
00060 }
00061 
00062 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00063 
00064 #endif // IGUANA_FRAMEWORK_IG_NAME_LIST_H

Generated on Tue Jun 9 17:38:19 2009 for CMSSW by  doxygen 1.5.4