Aria  2.8.0
ArUtil Class Reference

Contains various utility functions, including cross-platform wrappers around common system functions. More...

#include <ariaUtil.h>

Public Types

enum  BITS {
  BIT0 = 0x1, BIT1 = 0x2, BIT2 = 0x4, BIT3 = 0x8,
  BIT4 = 0x10, BIT5 = 0x20, BIT6 = 0x40, BIT7 = 0x80,
  BIT8 = 0x100, BIT9 = 0x200, BIT10 = 0x400, BIT11 = 0x800,
  BIT12 = 0x1000, BIT13 = 0x2000, BIT14 = 0x4000, BIT15 = 0x8000
}
 Values for the bits from 0 to 16. More...
 
enum  REGKEY {
  REGKEY_CLASSES_ROOT, REGKEY_CURRENT_CONFIG, REGKEY_CURRENT_USER, REGKEY_LOCAL_MACHINE,
  REGKEY_USERS
}
 These are for passing into getStringFromRegistry. More...
 

Static Public Member Functions

static void addDirectories (char *dest, size_t destLength, const char *baseDir, const char *insideDir)
 Adds two directories, taking care of all slash issues. More...
 
static void appendSlash (char *path, size_t pathLength)
 Appends a slash to a path if there is not one there already. More...
 
static void appendSlash (std::string &path)
 Appends a slash to the given string path if necessary. More...
 
static double atof (const char *nptr)
 Returns the floating point number from the string representation of that number in nptr, or HUGE_VAL for "inf" or -HUGE_VAL for "-inf".
 
static bool changeFileTimestamp (const char *fileName, time_t timestamp)
 Sets the timestamp on the specified file.
 
static const char * convertBool (int val)
 Converts an integer value into a string for true or false.
 
static int creat (const char *pathname, mode_t mode, bool closeOnExec=true)
 Opens a file, defaulting it so that the file will close on exec.
 
template<class T >
static void deleteSet (T begin, T end)
 Delete all members of a set. Does NOT empty the set. More...
 
template<class T >
static void deleteSetPairs (T begin, T end)
 Delete all members of a set. Does NOT empty the set. More...
 
static void escapeSpaces (char *dest, const char *src, size_t maxLen)
 Puts a \ before spaces in src, puts it into dest. More...
 
static double feetToMeters (const double f)
 Convert US feet to meters.
 
static bool findFile (const char *fileName)
 OS-independent way of checking to see if a file exists and is readable. More...
 
static bool findFirstStringInRegistry (const char *key, const char *value, char *str, int len)
 Returns a string from the Windows registry, searching each of the following registry root paths in order: REGKEY_CURRENT_USER, REGKEY_LOCAL_MACHINE.
 
static int findMax (int first, int second)
 Returns the maximum of the two values.
 
static double findMax (double first, double second)
 Returns the maximum of the two values.
 
static int findMin (int first, int second)
 Returns the minimum of the two values.
 
static double findMin (double first, double second)
 Returns the minimum of the two values.
 
static void fixSlashes (char *path, size_t pathLength)
 Fix the slash orientation in file path string for windows or linux. More...
 
static void fixSlashes (std::string &path)
 Fixes the slash orientation in the given file path string for the current platform. More...
 
static void fixSlashesBackward (char *path, size_t pathLength)
 Fix the slash orientation in file path string to be all backward. More...
 
static void fixSlashesForward (char *path, size_t pathLength)
 Fix the slash orientation in file path string to be all forward. More...
 
static bool floatIsNormal (double f)
 Return true if the value of f is not NaN and is not infinite (+/- INF)
 
static FILE * fopen (const char *path, const char *mode, bool closeOnExec=true)
 Opens a file, defaulting it so that the file will close on exec.
 
static void functorPrintf (ArFunctor1< const char *> *functor, char *str,...)
 Function for doing a printf style call to a functor. More...
 
static bool getDirectory (const char *fileName, char *result, size_t resultLen)
 Pulls the directory out of a file name.
 
static bool getFileName (const char *fileName, char *result, size_t resultLen)
 Pulls the filename out of the file name.
 
static char getSlash ()
 Returns the slash (i.e. separator) character for the current platform. More...
 
static bool getStringFromFile (const char *fileName, char *str, size_t strLen)
 Gets a string contained in an arbitrary file. More...
 
static bool getStringFromRegistry (REGKEY root, const char *key, const char *value, char *str, int len)
 Returns a string from the Windows registry. More...
 
static unsigned int getTime (void)
 Get the time in milliseconds. More...
 
static bool isOnlyAlphaNumeric (const char *str)
 Returns true if this string is only alphanumeric (i.e. it contains only leters and numbers), false if it contains any non alphanumeric characters (punctuation, whitespace, control characters, etc.)
 
static bool isOnlyNumeric (const char *str)
 Returns true if this string is only numeric (i.e. it contains only numeric.
 
static bool isStrEmpty (const char *str)
 Returns true if the given string is null or of zero length, false otherwise.
 
static bool isStrInList (const char *str, const std::list< std::string > &list, bool isIgnoreCase=false)
 Determines whether the given text is contained in the given list of strings.
 
static bool localtime (const time_t *timep, struct tm *result)
 Interface to native platform localtime() function. More...
 
static bool localtime (struct tm *result)
 Call ArUtil::localtime(const time_t*, struct tm *) with the current time obtained by calling time(NULL). More...
 
static void lower (char *dest, const char *src, size_t maxLen)
 Lowers a string from src into dest, make sure there's enough space. More...
 
static bool matchCase (const char *baseDir, const char *fileName, char *result, size_t resultLen)
 this matches the case out of what file we want More...
 
static double metersToFeet (const double m)
 Convert meters to US feet.
 
static double mSecToSec (const double msec)
 Convert milliseconds to seconds.
 
static int open (const char *pathname, int flags, bool closeOnExec=true)
 Opens a file, defaulting it so that the file will close on exec.
 
static int open (const char *pathname, int flags, mode_t mode, bool closeOnExec=true)
 Opens a file, defaulting it so that the file will close on exec.
 
static time_t parseTime (const char *str, bool *ok=NULL, bool toToday=true)
 Parses the given time string (h:mm) and returns the corresponding time. More...
 
static FILE * popen (const char *command, const char *type, bool closeOnExec=true)
 Opens a pipe, defaulting it so that the file will close on exec.
 
static void putCurrentDayInString (char *s, size_t len)
 Put the current day (GMT) of the month in s (e.g. More...
 
static void putCurrentHourInString (char *s, size_t len)
 Put the current hour (GMT) in s (e.g. More...
 
static void putCurrentMinuteInString (char *s, size_t len)
 Put the current minute (GMT) in s (e.g. More...
 
static void putCurrentMonthInString (char *s, size_t len)
 Put the current month (GMT) in s (e.g. More...
 
static void putCurrentSecondInString (char *s, size_t len)
 Put the current second (GMT) in s (e.g. More...
 
static void putCurrentYearInString (char *s, size_t len)
 Put the current year (GMT) in s (e.g. More...
 
static double secToMSec (const double sec)
 Convert seconds to milliseconds.
 
static void setFileCloseOnExec (int fd, bool closeOnExec=true)
 Sets if the file descriptor will be closed on exec or not.
 
static void setFileCloseOnExec (FILE *file, bool closeOnExec=true)
 Sets if the file descriptor will be closed on exec or not.
 
static long sizeFile (const char *fileName)
 OS-independent way of finding the size of a file. More...
 
static long sizeFile (std::string fileName)
 OS-independent way of finding the size of a file.
 
static void sleep (unsigned int ms)
 Sleep for the given number of milliseconds. More...
 
static int strcasecmp (std::string str, std::string str2)
 Finds out if two strings are equal (ignoring case) More...
 
static int strcasecmp (std::string str, const char *str2)
 Finds out if two strings are equal (ignoring case) More...
 
static int strcasecmp (const char *str, std::string str2)
 Finds out if two strings are equal (ignoring case) More...
 
static int strcasecmp (const char *str, const char *str2)
 Finds out if two strings are equal (ignoring case) More...
 
static int strcasequotecmp (const std::string &str1, const std::string &str2)
 Compares two strings (ignoring case and surrounding quotes) More...
 
static int strcmp (std::string str, std::string str2)
 Finds out if two strings are equal. More...
 
static int strcmp (std::string str, const char *str2)
 Finds out if two strings are equal. More...
 
static int strcmp (const char *str, std::string str2)
 Finds out if two strings are equal. More...
 
static int strcmp (const char *str, const char *str2)
 Finds out if two strings are equal. More...
 
static bool stripQuotes (char *dest, const char *src, size_t destLen)
 Strips out the quotes in the src buffer into the dest buffer.
 
static bool stripQuotes (std::string *strToStrip)
 Strips the quotes from the given string. More...
 
static bool strSuffixCaseCmp (const char *str, const char *suffix)
 Finds out if a string has a suffix.
 
static bool strSuffixCmp (const char *str, const char *suffix)
 Finds out if a string has a suffix.
 
static void writeToFile (const char *str, FILE *file)
 Function for doing a fprintf to a file (here to make a functor for)
 

Static Public Attributes

static const char * COM1 = "/dev/ttyS0"
 First serial port device name (value depends on compilation platform)
 
static const char * COM10 = "/dev/ttyS9"
 Tenth serial port device name (value depends on compilation platform)
 
static const char * COM11 = "/dev/ttyS10"
 Eleventh serial port device name (value depends on compilation platform)
 
static const char * COM12 = "/dev/ttyS11"
 Twelth serial port device name (value depends on compilation platform)
 
static const char * COM13 = "/dev/ttyS12"
 Thirteenth serial port device name (value depends on compilation platform)
 
static const char * COM14 = "/dev/ttyS13"
 Fourteenth serial port device name (value depends on compilation platform)
 
static const char * COM15 = "/dev/ttyS14"
 Fifteenth serial port device name (value depends on compilation platform)
 
static const char * COM16 = "/dev/ttyS15"
 Sixteenth serial port device name (value depends on compilation platform)
 
static const char * COM2 = "/dev/ttyS1"
 Second serial port device name (value depends on compilation platform)
 
static const char * COM3 = "/dev/ttyS2"
 Third serial port device name (value depends on compilation platform)
 
static const char * COM4 = "/dev/ttyS3"
 Fourth serial port device name (value depends on compilation platform)
 
static const char * COM5 = "/dev/ttyS4"
 Fifth serial port device name (value depends on compilation platform)
 
static const char * COM6 = "/dev/ttyS5"
 Sixth serial port device name (value depends on compilation platform)
 
static const char * COM7 = "/dev/ttyS6"
 Seventh serial port device name (value depends on compilation platform)
 
static const char * COM8 = "/dev/ttyS7"
 Eighth serial port device name (value depends on compilation platform)
 
static const char * COM9 = "/dev/ttyS8"
 Ninth serial port device name (value depends on compilation platform)
 
static const char * FALSESTRING = "false"
 "false"
 
static const char * TRUESTRING = "true"
 "true"
 

Static Protected Member Functions

static std::list< std::string > splitFileName (const char *fileName)
 this splits up a file name (it isn't exported since it'd crash with dlls) More...
 

Detailed Description

Contains various utility functions, including cross-platform wrappers around common system functions.

Member Enumeration Documentation

◆ BITS

Values for the bits from 0 to 16.

Enumerator
BIT0 

value of BIT0

BIT1 

value of BIT1

BIT2 

value of BIT2

BIT3 

value of BIT3

BIT4 

value of BIT4

BIT5 

value of BIT5

BIT6 

value of BIT6

BIT7 

value of BIT7

BIT8 

value of BIT8

BIT9 

value of BIT9

BIT10 

value of BIT10

BIT11 

value of BIT11

BIT12 

value of BIT12

BIT13 

value of BIT13

BIT14 

value of BIT14

BIT15 

value of BIT15

◆ REGKEY

These are for passing into getStringFromRegistry.

Enumerator
REGKEY_CLASSES_ROOT 

use HKEY_CLASSES_ROOT

REGKEY_CURRENT_CONFIG 

use HKEY_CURRENT_CONFIG

REGKEY_CURRENT_USER 

use HKEY_CURRENT_USER

REGKEY_LOCAL_MACHINE 

use HKEY_LOCAL_MACHINE

REGKEY_USERS 

use HKEY_USERS

Member Function Documentation

◆ addDirectories()

void ArUtil::addDirectories ( char *  dest,
size_t  destLength,
const char *  baseDir,
const char *  insideDir 
)
static

Adds two directories, taking care of all slash issues.

This function will take the baseDir and add insideDir after it, separated by appropriate directory path separators for this platform, with a final directory separator retained or added after inside dir.

For example on Linux, this results in 'baseDir/insideDir/', whereas backslashes are used on Windows instead. The resulting string is placed in the dest buffer (the path string will be truncated if there is not enough space in dest according to destLength)

Parameters
destthe place to put the result
destLengththe length available in dest
baseDirthe directory to start with
insideDirthe directory to place after the baseDir

◆ appendSlash() [1/2]

void ArUtil::appendSlash ( char *  path,
size_t  pathLength 
)
static

Appends a slash to a path if there is not one there already.

Append a directory separator character to the given path string, depending on the platform.

On Windows, a backslash ('\') is added. On other platforms, a forward slash ('/') is appended. If there is no more allocated space in the path string (as given by the

  • pathLength parameter), no character will be appended.
    Parameters
    paththe path string to append a slash to
    pathLengthmaximum length allocated for path string

◆ appendSlash() [2/2]

void ArUtil::appendSlash ( std::string &  path)
static

Appends a slash to the given string path if necessary.

Append the appropriate directory separator for this platform (a forward slash "/" on Linux, or a backslash "\" on Windows) to.

  • path.

◆ deleteSet()

template<class T >
static void ArUtil::deleteSet ( begin,
end 
)
inlinestatic

Delete all members of a set. Does NOT empty the set.

Assumes that T is an iterator that supports the operator*, operator!= and operator++. The return is assumed to be a pointer to a class that needs to be deleted.

◆ deleteSetPairs()

template<class T >
static void ArUtil::deleteSetPairs ( begin,
end 
)
inlinestatic

Delete all members of a set. Does NOT empty the set.

Assumes that T is an iterator that supports the operator**, operator!= and operator++. The return is assumed to be a pair. The second value of the pair is assumed to be a pointer to a class that needs to be deleted.

◆ escapeSpaces()

void ArUtil::escapeSpaces ( char *  dest,
const char *  src,
size_t  maxLen 
)
static

Puts a \ before spaces in src, puts it into dest.

This copies src into dest but puts a \ before any spaces in src, escaping them...

its mostly for use with ArArgumentBuilder... make sure you have at least maxLen spaces in the arrays that you're passing as dest... this allocates no memory

◆ findFile()

bool ArUtil::findFile ( const char *  fileName)
static

OS-independent way of checking to see if a file exists and is readable.

Returns
true if file is found
Parameters
fileNamename of the file to size

◆ fixSlashes() [1/2]

void ArUtil::fixSlashes ( char *  path,
size_t  pathLength 
)
static

Fix the slash orientation in file path string for windows or linux.

Replace in path all incorrect directory separators for this platform with the correct directory separator character (forward slash '/' on Linux, backslash '\' on Windows).

Parameters
paththe path in which to fix the orientation of the slashes
pathLengththe maximum length of path

◆ fixSlashes() [2/2]

void ArUtil::fixSlashes ( std::string &  path)
static

Fixes the slash orientation in the given file path string for the current platform.

Replace in path all incorrect directory separators for this platform with the correct directory separator character (forward slash '/' on Linux, backslash '\' on Windows).

Parameters
paththe path in which to fix the orientation of the slashes

◆ fixSlashesBackward()

void ArUtil::fixSlashesBackward ( char *  path,
size_t  pathLength 
)
static

Fix the slash orientation in file path string to be all backward.

Replace any forward slash charactars ('/') in path with backslashes ('\').

Parameters
paththe path in which to fix the orientation of the slashes
pathLengthsize of path

◆ fixSlashesForward()

void ArUtil::fixSlashesForward ( char *  path,
size_t  pathLength 
)
static

Fix the slash orientation in file path string to be all forward.

Replace any forward slash charactars ('/') in path with backslashes ('\').

Parameters
paththe path in which to fix the orientation of the slashes
pathLengthsize of path

◆ functorPrintf()

void ArUtil::functorPrintf ( ArFunctor1< const char *> *  functor,
char *  str,
  ... 
)
static

Function for doing a printf style call to a functor.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

◆ getSlash()

char ArUtil::getSlash ( )
static

Returns the slash (i.e. separator) character for the current platform.

What is the appropriate directory path separator character for this platform?

◆ getStringFromFile()

bool ArUtil::getStringFromFile ( const char *  fileName,
char *  str,
size_t  strLen 
)
static

Gets a string contained in an arbitrary file.

This function reads a string from a file.

The file can contain spaces or tabs, but a '\r' or '\n' will be treated as the end of the string, and the string cannot have more characters than the value given by strLen. This is mostly for internal use with Linux to determine the Aria directory from a file in /etc, but will work with Linux or Windows.

Parameters
fileNamename of the file in which to look
strthe string to copy the file contents into
strLenthe maximum allocated length of str

◆ getStringFromRegistry()

bool ArUtil::getStringFromRegistry ( REGKEY  root,
const char *  key,
const char *  value,
char *  str,
int  len 
)
static

Returns a string from the Windows registry.

Look up the given value under the given key, within the given registry root key.

Parameters
rootthe root key to use, one of the REGKEY enum values
keythe name of the key to find
valuethe value name in which to find the string
strwhere to put the string found, or if it could not be found, an empty (length() == 0) string
lenthe length of the allocated memory in str
Returns
true if the string was found, false if it was not found or if there was a problem such as the string not being long enough

◆ getTime()

unsigned int ArUtil::getTime ( void  )
static

Get the time in milliseconds.

Get the time in milliseconds, counting from some arbitrary point.

This time is only valid within this run of the program, it does not represent "time of day". In other words, values returned by getTime() may be compared to each other within the same run time of a program. If ARIA was compiled on Linux with POSIX monotonic clock functions available, and the current running Linux kernel supports the monotonic clock, then the clock_gettime() function is used with the CLOCK_MONOTONIC option (this is an accurate clock that is robust against e.g. changes to the system time, etc.). Otherwise, gettimeofday() is used instead. Programs using ARIA on Linux must therefore link to the librt library (with -lrt) as well as libAria. On Windows, the timeGetTime() function is used from the winmm library – this means programs using ARIA on Windows must be linked to the winmm.lib library as well as ARIA.

Returns
millisecond time

◆ localtime() [1/2]

bool ArUtil::localtime ( const time_t *  timep,
struct tm *  result 
)
static

Interface to native platform localtime() function.

On Linux, this is equivalent to a call to localtime_r(timep, result) (which is threadsafe, including the returned pointer, since it uses a different time struct for each thread) On Windows, this is equivalent to a call to localtime(timep, result). In addition, a static mutex is used to make it threadsafe.

Parameters
timepPointer to current time (Unix time_t; seconds since epoch)
resultThe result of calling platform localtime function is copied into this struct, so it must have been allocated.
Returns
false on error (e.g. invalid input), otherwise true.

Example:

struct tm t;
ArUtil::localtime(time(NULL), &t);
ArLog::log("Current month is %d.\n", t.tm_mon);

◆ localtime() [2/2]

bool ArUtil::localtime ( struct tm *  result)
static

Call ArUtil::localtime(const time_t*, struct tm *) with the current time obtained by calling time(NULL).

Call ArUtil::localtime() with the current time obtained by calling time(NULL).

Returns
false on error (e.g. invalid input), otherwise true.

◆ lower()

void ArUtil::lower ( char *  dest,
const char *  src,
size_t  maxLen 
)
static

Lowers a string from src into dest, make sure there's enough space.

This copies src into dest but makes it lower case make sure you have at least maxLen arrays that you're passing as dest...

this allocates no memory

◆ matchCase()

bool ArUtil::matchCase ( const char *  baseDir,
const char *  fileName,
char *  result,
size_t  resultLen 
)
static

this matches the case out of what file we want

Parameters
baseDirthe base directory to work from
fileNamethe fileName to squash the case from
resultwhere to put the result
resultLenlength of the result
Returns
true if it could find the file, the result is in result, false if it couldn't find the file

◆ parseTime()

time_t ArUtil::parseTime ( const char *  str,
bool *  ok = NULL,
bool  toToday = true 
)
static

Parses the given time string (h:mm) and returns the corresponding time.

Parameters
strthe char * string to be parsed; in the 24-hour format h:mm
okan output bool * set to true if the time is successfully parsed; false, otherwise
toTodaytrue to find the time on the current day, false to find the time on 1/1/70
Returns
time_t if toToday is true then its the parsed time on the current day, if toToday is false then its the parsed time on 1/1/70 1/1/70

◆ putCurrentDayInString()

void ArUtil::putCurrentDayInString ( char *  s,
size_t  len 
)
static

Put the current day (GMT) of the month in s (e.g.

"20").

Parameters
sString buffer (allocated) to write day into
lenSize of s

◆ putCurrentHourInString()

void ArUtil::putCurrentHourInString ( char *  s,
size_t  len 
)
static

Put the current hour (GMT) in s (e.g.

"13" for 1 o'clock PM).

Parameters
sString buffer (allocated) to write hour into
lenSize of s

◆ putCurrentMinuteInString()

void ArUtil::putCurrentMinuteInString ( char *  s,
size_t  len 
)
static

Put the current minute (GMT) in s (e.g.

"05").

Parameters
sString buffer (allocated) to write minutes into
lenSize of s

◆ putCurrentMonthInString()

void ArUtil::putCurrentMonthInString ( char *  s,
size_t  len 
)
static

Put the current month (GMT) in s (e.g.

"09" if September).

Parameters
sString buffer (allocated) to write month into
lenSize of s

◆ putCurrentSecondInString()

void ArUtil::putCurrentSecondInString ( char *  s,
size_t  len 
)
static

Put the current second (GMT) in s (e.g.

"59").

Parameters
sString buffer (allocated) to write seconds into
lenSize of s

◆ putCurrentYearInString()

void ArUtil::putCurrentYearInString ( char *  s,
size_t  len 
)
static

Put the current year (GMT) in s (e.g.

"2005").

Parameters
sString buffer (allocated) to write year into
lenSize of s

◆ sizeFile()

long ArUtil::sizeFile ( const char *  fileName)
static

OS-independent way of finding the size of a file.

Returns
size in bytes. -1 on error.
Parameters
fileNamename of the file to size

◆ sleep()

void ArUtil::sleep ( unsigned int  ms)
static

Sleep for the given number of milliseconds.

Sleep (do nothing, without continuing the program) for.

  • ms miliseconds. Use this to add idle time to threads, or in situations such as waiting for hardware with a known response time. To perform actions at specific intervals, however, use the ArTime timer utility instead, or the ArUtil::getTime() method to check time.
    Note
    in Linux, it actually calls the system usleep() function with 10 ms less than the desired sleep time, since usleep() can sleep for about 10 ms. more than requested (for small sleep times especially, it sleeps for the next highest multiple of 10.)
    Parameters
    msthe number of milliseconds to sleep for
Examples:
actsColorFollowingExample.cpp, armExample.cpp, cameraPTZExample.cpp, demo.cpp, directMotionExample.cpp, gotoActionExample.cpp, gpsExample.cpp, imuExample.cpp, laserConnect.cpp, lasers.cpp, moduleExample.cpp, mtxIO.cpp, mtxLCDDisplay.cpp, mtxPowerControl.cpp, mtxWheelLights.cpp, netServerExample.cpp, robotConnectionCallbacks.cpp, seekurPower.cpp, simpleConnect.cpp, simpleMotionCommands.cpp, soundsQueueExample.cpp, and threadExample.cpp.

◆ splitFileName()

std::list< std::string > ArUtil::splitFileName ( const char *  fileName)
staticprotected

this splits up a file name (it isn't exported since it'd crash with dlls)

This function assumes the slashes are all heading the right way already.

◆ strcasecmp() [1/4]

int ArUtil::strcasecmp ( std::string  str,
std::string  str2 
)
static

Finds out if two strings are equal (ignoring case)

This compares two strings ignoring case, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcasecmp() [2/4]

int ArUtil::strcasecmp ( std::string  str,
const char *  str2 
)
static

Finds out if two strings are equal (ignoring case)

This compares two strings ignoring case, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcasecmp() [3/4]

int ArUtil::strcasecmp ( const char *  str,
std::string  str2 
)
static

Finds out if two strings are equal (ignoring case)

This compares two strings ignoring case, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcasecmp() [4/4]

int ArUtil::strcasecmp ( const char *  str,
const char *  str2 
)
static

Finds out if two strings are equal (ignoring case)

This compares two strings ignoring case, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcasequotecmp()

int ArUtil::strcasequotecmp ( const std::string &  str1,
const std::string &  str2 
)
static

Compares two strings (ignoring case and surrounding quotes)

This helper method is primarily used to ignore surrounding quotes when comparing ArArgumentBuilder args.

Returns
int set to 0 if the two strings are equivalent, a negative number if str1 is "less than" str2, and a postive number if it is "greater than".

◆ strcmp() [1/4]

int ArUtil::strcmp ( std::string  str,
std::string  str2 
)
static

Finds out if two strings are equal.

This compares two strings, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

(This is a version of the standard C strcmp() function for use with std::string strings instead.)

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcmp() [2/4]

int ArUtil::strcmp ( std::string  str,
const char *  str2 
)
static

Finds out if two strings are equal.

This compares two strings, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

(This is a version of the standard C strcmp() function for use with std::string strings instead.)

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcmp() [3/4]

int ArUtil::strcmp ( const char *  str,
std::string  str2 
)
static

Finds out if two strings are equal.

This compares two strings, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

(This is a version of the standard C strcmp() function for use with std::string strings instead.)

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ strcmp() [4/4]

int ArUtil::strcmp ( const char *  str,
const char *  str2 
)
static

Finds out if two strings are equal.

This compares two strings, it returns an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

Parameters
strthe string to compare
str2the second string to compare
Returns
an integer less than, equal to, or greater than zero if str is found, respectively, to be less than, to match, or be greater than str2.

◆ stripQuotes()

bool ArUtil::stripQuotes ( std::string *  strToStrip)
static

Strips the quotes from the given string.

This method behaves similarly to the char[] version, except that it modifies the given std::string.

If the first and last characters of the string are quotation marks ("), then they are removed from the string. Multiple nested quotation marks are not handled.

Parameters
strToStripa pointer to the std::string to be read/modified; must be non-NULL
Returns
bool true if the string was successfully processed; false otherwise

The documentation for this class was generated from the following files: