Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

util.cpp File Reference

#include "util.h"

Include dependency graph for util.cpp:

Go to the source code of this file.

Functions

int compareIgnoringCase (const string &s1, const string &s2, int n)
int compareIgnoringCase (const string &s1, const string &s2)


Function Documentation

int compareIgnoringCase const string s1,
const string s2,
int  n
 

Definition at line 34 of file util.cpp.

00035 {
00036     string::const_iterator i1 = s1.begin();
00037     string::const_iterator i2 = s2.begin();
00038 
00039     while (i1 != s1.end() && i2 != s2.end() && n > 0)
00040     {
00041         if (toupper(*i1) != toupper(*i2))
00042             return (toupper(*i1) < toupper(*i2)) ? -1 : 1;
00043         ++i1;
00044         ++i2;
00045         n--;
00046     }
00047 
00048     if (n > 0)
00049         return s2.size() - s1.size();
00050     else
00051         return 0;
00052 }

int compareIgnoringCase const string s1,
const string s2
 

Definition at line 17 of file util.cpp.

Referenced by Greek::canonicalAbbreviation(), CreatePlanet(), DetermineFileType(), Constellation::getConstellation(), CelestiaCore::initSimulation(), DSODatabase::load(), observer_splitview(), CompareIgnoringCasePredicate::operator()(), CatalogCrossReference::parse(), CommandParser::parseCommand(), parseCoordinateSystem(), parseCoordSys(), parseLabelFlags(), parseMarkerSymbol(), parseOrbitFlags(), parseRenderFlags(), parseSimpleCatalogNumber(), parseTychoCatalogNumber(), CommandCapture::process(), CommandSet::process(), ReadDestinationList(), Url::Url(), and WinMain().

00018 {
00019     string::const_iterator i1 = s1.begin();
00020     string::const_iterator i2 = s2.begin();
00021 
00022     while (i1 != s1.end() && i2 != s2.end())
00023     {
00024         if (toupper(*i1) != toupper(*i2))
00025             return (toupper(*i1) < toupper(*i2)) ? -1 : 1;
00026         ++i1;
00027         ++i2;
00028     }
00029 
00030     return s2.size() - s1.size();
00031 }


Generated on Sat Jan 14 22:33:01 2006 for Celestia by  doxygen 1.4.1