Core Library
Classes | Namespaces | Functions
StringUtils.cpp File Reference

Utility functions for formatting strings. More...

#include "Common.hpp"
#include "StringUtils.hpp"
#include <stdarg.h>
#include <tchar.h>
#include <limits>
#include <stdio.h>
#include <Core/BadLogicException.hpp>
#include <Core/ParseException.hpp>
#include "AnsiWide.hpp"
#include <locale>
#include <stdlib.h>

Classes

struct  Core::FormatTraits< T >
 Traits to invoke the underlying formatting and parsing functions for the specified template type. More...
struct  Core::FormatTraits< int >
 Formatting and parsing functions for handling int's. More...
struct  Core::FormatTraits< uint >
 Formatting and parsing functions for handling unsigned int's. More...
struct  Core::FormatTraits< longlong >
 Formatting and parsing functions for handling long long int's. More...
struct  Core::FormatTraits< ulonglong >
 Formatting and parsing functions for handling unsigned long long int's. More...

Namespaces

namespace  Core
 

The Core Library namespace.


Functions

tstring Core::fmtEx (const tchar *pszFormat, va_list args)
 Format the string ala printf.
tstring Core::fmt (const tchar *pszFormat,...)
 Format the string ala printf.
template<typename T , typename Traits >
tstring Core::formatInteger (const T &value)
 Generic function for parsing integers.
template<>
tstring Core::format (const bool &value)
 Format a boolean value into a string.
template<>
tstring Core::format (const int &value)
 Format a signed integer value into a string.
template<>
tstring Core::format (const uint &value)
 Format an unsigned integer value into a string.
template<>
tstring Core::format (const longlong &value)
 Format a signed long long integer value into a string.
template<>
tstring Core::format (const ulonglong &value)
 Format a unsigned long long integer value into a string.
template<typename T , typename Traits >
Core::parseInteger (const tstring &buffer)
 Generic function for parsing integers.
template<>
bool Core::parse (const tstring &buffer)
 Parse a boolean value from a string.
void Core::makeUpper (tstring &string)
 Convert a string to upper case.
tstring Core::createUpper (tstring string)
 Create an upper case version of a string.
void Core::makeLower (tstring &string)
 Convert a string to lower case.
tstring Core::createLower (tstring string)
 Create a lower case version of a string.
void Core::trimLeft (tstring &string)
 Trim any leading whitespace from the string.
void Core::trimRight (tstring &string)
 Trim any trailing whitespace from the string.
void Core::trim (tstring &string)
 Trim any leading or trailing whitespace from the string.
tstring Core::trimCopy (tstring string)
 Trim any leading or trailing whitespace from a copy of the string.
size_t strnlen (const char *string, size_t bufsize)
 Get the length of a string, using the current locale or one that has been passed in.
size_t wcsnlen (const wchar_t *string, size_t bufsize)
 Get the length of a string, using the current locale or one that has been passed in.

Detailed Description

Utility functions for formatting strings.

Author:
Chris Oldwood

Function Documentation

size_t strnlen ( const char *  string,
size_t  bufsize 
)

Get the length of a string, using the current locale or one that has been passed in.

More secure versions of strlen().

size_t wcsnlen ( const wchar_t *  string,
size_t  bufsize 
)

Get the length of a string, using the current locale or one that has been passed in.

More secure versions of strlen().