utils Namespace Reference


Functions

void replace (string &where, const string &what, const string &by)
bool start_with (const string &str, const string &what)
bool end_with (const string &str, const string &what)
void replace (std::string &where, const std::string &what, const std::string &by)
bool start_with (const std::string &str, const std::string &what)
bool end_with (const std::string &str, const std::string &what)


Function Documentation

bool utils::end_with ( const std::string &  str,
const std::string &  what 
)

bool utils::end_with ( const string &  str,
const string &  what 
)

Definition at line 46 of file Utils.cpp.

00046                                                      {
00047     if (what.length() <= str.length())
00048     {
00049         string::const_iterator str_iter = str.begin();
00050         for (string::const_reverse_iterator i=what.rbegin(); i!=what.rend();++i) {
00051             if (*i != *str_iter)
00052                 return false;
00053             ++str_iter;
00054         }
00055         return true;        
00056     }
00057     return false;
00058 }

void utils::replace ( std::string &  where,
const std::string &  what,
const std::string &  by 
)

void utils::replace ( string &  where,
const string &  what,
const string &  by 
)

Definition at line 24 of file Utils.cpp.

Referenced by applyModification(), getContent(), main(), and StringBuffer::replace().

00025 {
00026     for (string::size_type  i  = where.find(what);
00027                             i != string::npos;
00028                             i  = where.find(what, i + by.size()))
00029         where.replace(i, what.size(), by);
00030 }

Here is the caller graph for this function:

bool utils::start_with ( const std::string &  str,
const std::string &  what 
)

bool utils::start_with ( const string &  str,
const string &  what 
)

Definition at line 32 of file Utils.cpp.

Referenced by addClassCpp(), addFunctionCpp(), applyModification(), Ast::functionBoxing(), Ast::functionMapping(), Ast::is_skeleton_node(), NumberSunkDiffuseInputs::operator()(), NumberResources::operator()(), NumberSinks::operator()(), and Ast::sourceBoxing().

00032                                                        {
00033     if (what.length() <= str.length())
00034     {
00035         string::const_iterator str_iter = str.begin();
00036         for (string::const_iterator i=what.begin(); i!=what.end();++i) {
00037             if (*i != *str_iter)
00038                 return false;
00039             ++str_iter;
00040         }
00041         return true;        
00042     }
00043     return false;
00044 }

Here is the caller graph for this function:


Generated on Wed Feb 27 20:32:52 2008 for php.ast.svn.src. by  doxygen 1.5.3