Namespaces | Classes | Typedefs | Enumerations | Functions | Variables

Celartem Namespace Reference

Namespaces

namespace  DjVu
namespace  FileUtils
namespace  License

Classes

class  AutoPtr
struct  ModuleDefinition
struct  SystemReserved
struct  Base64T
struct  Base64Traits_A
struct  UrlSafeBase64Traits
struct  Blob
struct  DataTraits< Blob< SIZE > >
class  ResourceBroker
class  Checksum
class  MD5Checksum
class  SHA1Checksum
class  SHA256Checksum
class  ChecksumStream
class  MD5Stream
class  SHA1Stream
class  SHA256Stream
struct  Zlib
class  DeflateStream
class  InflateStream
class  CredentialInfo
class  CredentialProvider
class  BlockCipher
class  CipherStream
class  DataStore
struct  DataTraits
struct  Debug
class  BasicDataArray
class  DataArray
class  ModuleDynamicLoader
class  ErrorSaver
struct  Error
class  Exception
class  Path
struct  GenRandom
struct  Point
struct  Size
struct  Rect
struct  Guid
struct  HttpHeaderEntry
class  HttpManager
class  HttpConnection
class  HttpRequestStream
class  HttpResponseStream
class  Lockable
class  Locker
class  MemoryAllocator
struct  MemoryCopy< T, byConstructor >
struct  MemoryCopy< T, byMemcpy >
struct  MemoryCopy< T, noCopy >
struct  MemoryMove< T, byConstructor >
struct  MemoryMove< T, byMemcpy >
struct  MemoryMove< T, noCopy >
struct  MemoryFill
struct  MemoryFill< int8_t >
struct  MemoryFill< uint8_t >
class  SimpleArray
struct  Decimal
struct  Hex
class  Observable
class  Observer
class  ObserverImpl
struct  Printf
struct  Printf< char >
struct  Printf< wchar_t >
class  Random
struct  Rational
struct  DataTraits< Rational< Int > >
class  Referable
class  ReferableNoTS
class  RegEx
class  RegularExpression
class  _rwlock_
class  ReaderWriterLock
class  RWLock
class  ReaderWriterLockLockerTempl
class  SecureString
class  Serializable
struct  SerializableDataHelper
struct  SerializableDataHelper< T, true >
class  SerializableData
struct  sstring
class  StdioStream
class  Storage
class  BlockReadStorage
class  StorageRollback
class  StorageRewinder
class  DiskStorage
struct  LockStorageRegion
class  DiskStorageLock
class  DiskStorageWithRollback
class  MemoryStorage
class  RomStorage
class  WrapperStorage
class  StorageOffsetter
class  PartialStorage
struct  Range
class  StorageLoader
class  AdvCachedStorage
class  Stream
struct  WriteData
struct  WriteData< T, notToBeStored >
struct  WriteData< T, byCopyBytes >
struct  WriteData< T, bySwapCopyBytes >
struct  WriteData< T, byClassMethods >
struct  ReadData
struct  ReadData< T, notToBeStored >
struct  ReadData< T, byCopyBytes >
struct  ReadData< T, bySwapCopyBytes >
struct  ReadData< T, byClassMethods >
class  NullStream
class  ByteCounterStream
class  PartialStream
class  ReferableString
 Do not use this interface directly; use String instead of it. More...
struct  utf8s
 This class is to pass UTF-8 string directly to String class. More...
class  Region
 This class stores information about matching region. More...
class  String
 This class stores C/C++ style null terminated string. More...
struct  CharsetConverter
struct  CharsetConverter< char >
struct  CharsetConverter< UChar2 >
struct  CharsetConverter< UChar4 >
struct  DefaultCharTraits
struct  StringUtil
struct  ThreadSafeOperation
class  Semaphore
class  Mutex
class  Event
class  NamedMutex
struct  ThreadUtil
class  Thread
struct  Time
struct  TimeSpan
struct  TimeUtils
class  DebugTimer
struct  UCharDefs< 2 >
struct  UCharDefs< 4 >
struct  UtfTraits
struct  UtfTraits< UChar4 >
struct  UnicodeCharTraits
struct  Converter
struct  Url
 Url provides utility functions to deal with URL/URI strings. More...
struct  UtfTraits< UChar2 >
struct  DefaultCharTraits< UChar2 >
struct  UtfTraits< UChar1 >

Typedefs

typedef Base64T< Base64Traits_ABase64
typedef Base64T
< UrlSafeBase64Traits
UrlSafeBase64
typedef u8 guid_t [16]
typedef AdvCachedStorage HttpStorage
typedef Rational< uint32_t > TIFF_RATIONAL
typedef Rational< int32_t > TIFF_SRATIONAL
typedef
ReaderWriterLockLockerTempl
< true > 
WriterLock
typedef
ReaderWriterLockLockerTempl
< false > 
ReaderLock
typedef AutoPtr< Serializable >(* DeserializeFunc )(Stream *inStream, size_t inLevel, Endian inEndian)
typedef Range< uint64_t > StorageRange
typedef void(* DuplicateStreamCallback )(void *inContext, size_t inBytesCopied, size_t inMaximumBytesToCopy)
typedef int8_t i8
 8-byte value (signed).
typedef int16_t i16
 16-bit value (signed).
typedef int32_t i32
 32-bit value (signed).
typedef int64_t i64
 64-bit value (signed).
typedef uint8_t u8
 8-bit value (unsigned).
typedef uint16_t u16
 16-bit value (unsigned).
typedef uint32_t u32
 32-bit value (unsigned).
typedef uint64_t u64
 64-bit value (unsigned).
typedef UCharDefs< sizeof(wchar_t)>
::UChar1 
UChar1
 The definition of UChar1, which stores UTF-8 character.
typedef UCharDefs< sizeof(wchar_t)>
::UChar2 
UChar2
 The definition of UChar1, which stores UTF-16 character.
typedef UCharDefs< sizeof(wchar_t)>
::UChar4 
UChar4
 The definition of UChar1, which stores UTF-32 character.

Enumerations

enum  AuthTargetType {
  authGeneral = 0, authHttpBasic = 1, authHttpProxy = 2, authPixelSafe2Local = 3,
  authPixelSafe2 = 4, authPixelSafe3 = 5
}
enum  CopyPolicy { noCopy = 0, byConstructor = 1, byMemcpy = 2 }
enum  StoragePolicy { notToBeStored = 0, byCopyBytes = 1, bySwapCopyBytes = 2, byClassMethods = 3 }
enum  Endian { endianBig = 1234, endianLittle = 4321, endianHost = ENDIAN_HOST }
enum  GeneralErrorDefinition {
  errInternalError = -2, errUnknown = -1, errSuccess = 0, errOutOfMemory,
  errBadAccess, errAccessDenied, errNotPermitted, errAuthFailed,
  errAuthRequired, errInvalidParam, errDivByZero, errInvalidState,
  errAlreadyExists, errNotAvailable, errNotFound, errEOF,
  errInitializationFailed, errOpenFailed, errReadFailed, errWriteFailed,
  errSetPosFailed, errBufferOverFlow, errDataBroken, errStringTooLong,
  errTypeMismatch, errChecksumError, errProcessCanceled, errStorageIsProtected,
  errOperationFailed, errNotSupported, errNotImplemented, errAssertionFailed,
  errSecurityValidation, errLicenseViolation, errCartridgeNotEnough, errTooManyCartridges,
  errTimeStampError, errTrialConfiction, errLicenseExpired, errMachineIdMismatch,
  errNullPointer, errDataTooLarge, errSemInitFailed = 5000, errMutexInitFailed,
  errEventInitFailed, errGateInitFailed, errLockFailed, errUnlockFailed,
  errSignalFailed, errWaitFaild, errBeginThreadFailed, errAlreadyRunning,
  errNotRunning
}
 

General errors.

More...
enum  ProxyType { proxyAuto = 0, proxyManual = 1, proxyDirect = 2 }
enum  YesNo { no = 0, yes = 1 }
enum  RegexOptionFlag {
  regex_default = 0, regex_multiline = 1, regex_ignoreCase = 2, regex_longest_match = 4,
  regex_ignore_empty = 8
}
enum  AccessMode { accessRead = 1, accessWrite = 2, accessRW = 3 }
 

File Access Modes.

More...
enum  CreationMode {
  creationDefault = 0, openExisting = 1, openAlways = 2, createNew = 3,
  createAlways = 4, truncateExisting = 5
}
 

File Creation Modes.

More...
enum  NULL_STRING
 

This enumeration defines NullString.

More...

Functions

template<class T >
swap (const T &n)
template<class T >
toBig (const T &num)
template<class T >
toLittle (const T &num)
template<class T >
fromBig (const T &num)
template<class T >
fromLittle (const T &num)
template<class T >
void write (void *CEL_RESTRICT buffer, T t, Endian endian)
template<class T >
void writeArray (void *CEL_RESTRICT buffer, T *CEL_RESTRICT array, size_t count, Endian endian)
template<class T >
read (const void *CEL_RESTRICT buffer, Endian endian)
template<class T >
void swapBytes (const void *CEL_RESTRICT ioBuffer, size_t inBytes)
 CEL_DEFINE_DATATRAITS (Locker, byConstructor, notToBeStored)
template<size_t ALIGN, class Int >
Int align (Int sz)
void cel_puts (const char *message)
void cel_vprintf (const char *format, std::va_list ap)
void cel_printf (const char *format,...)
void cel_dbgPrintf (const char *format,...)
std::string cel_printf_string (const char *format,...)
template<typename T >
void write (Stream *inStream, const T &n, Endian inEndian)
template<typename T >
read (Stream *inStream, Endian inEndian)
String operator+ (const utf8s &str1, const String &str2)
String operator+ (const char *str1, const String &str2)
String operator+ (const UChar2 *str1, const String &str2)
String operator+ (const UChar4 *str1, const String &str2)
String format (const char *inFormat,...)
String format (const wchar_t *inFormat,...)
String format_utf8 (const char *inFormat,...)
String repeatString (const String &string, size_t count)
String stringFromUnicode (const UChar1 *string, size_t length=-1)
String stringFromUnicode (const UChar2 *string, size_t length=-1)
String stringFromUnicode (const UChar4 *string, size_t length=-1)
String repeatChar (UChar4 chr, size_t count)
String chr (UChar4 chr)

Variables

static const size_t notFound = (size_t)SSIZE_MIN
 Indicates "Not Found".
static const size_t STR_AUTOSIZE = (size_t)SSIZE_MIN
 Instructs the method to check the length.

Detailed Description

Celartem is the primary namespace for Celartem Base Library. All the functions, classes, and other definitions are in this namespace.


Typedef Documentation

Base64 encode/decode routines.
The following sample illustrates how to use this class:

// encode
u8 bin[] = {23, 53, 0, 12, 43, 32, 98, 127};
String encoded = Base64::encode(bin, sizeof(bin));

// decode
SimpleArray<u8> decoded;
Base64::decode(decoded, encoded);
typedef AutoPtr<Serializable>(* Celartem::DeserializeFunc)(Stream *inStream, size_t inLevel, Endian inEndian)

This is the factory definition of Serializable objects.
All classes that inherit Serializable class should implement a function named deserialize to register with REGISTER_SERIALIZABLECLASS or REGISTER_SERIALIZABLECLASS2 macro.
This function (actually, static member) reads data from the specified storage, constructs a new instance and return a pointer to it.
For example, a Serializable derivative class that stores uint32_t value can be implemented like the following code:

            class SerializableIntContainer : public Serializable
            {
            public:
                ...

                static AutoPtr<Serializable> deserialize(
                    Stream *inStream, size_t inLevel, Endian inEndian)
                {
                    uint32_t n = read<uint32_t>(inStream, inEndian);
                    SerializableIntContainer *pInt
                        = new SerializableIntContainer(n);
                }

                ...
            private:
                uint32_t m_value;

                // This constructor should not be called directly and you
                // should call deserialize method.
                SerializableIntContainer(uint32_t n) : m_value(n)
                {
                }
            };
Parameters:
inStream The stream from which the instance information is read.
inLevel The de-serialization level. In the top level, this value is 0.
inEndian The endianness used to read the data.
Returns:
Pointer to the newly created Serializable instance.
typedef void(* Celartem::DuplicateStreamCallback)(void *inContext, size_t inBytesCopied, size_t inMaximumBytesToCopy)

The definition for DuplicateStreamCallback.

Parameters:
inContext The callback context.
inBytesCopied The number of bytes already copied.
inMaximumBytesToCopy The number of bytes to be copied.
If the total number of bytes to be copied is unknown, this is 0.
typedef u8 Celartem::guid_t[16]

guid_t just preserves the GUID/UUID.

HttpStorage is an interface of Http based storages. The instances of this class created by HttpManager::createHttpStorage .

typedef int16_t Celartem::i16

16-bit value (signed).

typedef int32_t Celartem::i32

32-bit value (signed).

typedef int64_t Celartem::i64

64-bit value (signed).

typedef int8_t Celartem::i8

8-byte value (signed).

ReaderLock locks a ReaderWriterLock instance for read.

typedef Range<uint64_t> Celartem::StorageRange

A specialized version of Range which can be used with 64bit storage range.

typedef Rational<uint32_t> Celartem::TIFF_RATIONAL

This type is defined for supporting TIFF data natively. This structure is corresponding to 5=RATIONAL type of TIFF 6.0 specification.
For more information, see TIFF (TM) Revision 6.0 specification. http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf

See also:
TIFF_SRATIONAL, Rational

This type is defined for supporting TIFF data natively. This structure is corresponding to 10=SRATIONAL type of TIFF 6.0 specification. For more information, see TIFF (TM) Revision 6.0 specification. http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf

See also:
TIFF_RATIONAL, Rational
typedef uint16_t Celartem::u16

16-bit value (unsigned).

typedef uint32_t Celartem::u32

32-bit value (unsigned).

typedef uint64_t Celartem::u64

64-bit value (unsigned).

typedef uint8_t Celartem::u8

8-bit value (unsigned).

typedef UCharDefs<sizeof(wchar_t)>::UChar1 Celartem::UChar1

The definition of UChar1, which stores UTF-8 character.

typedef UCharDefs<sizeof(wchar_t)>::UChar2 Celartem::UChar2

The definition of UChar1, which stores UTF-16 character.

typedef UCharDefs<sizeof(wchar_t)>::UChar4 Celartem::UChar4

The definition of UChar1, which stores UTF-32 character.

UrlSafeBase64 encode/decode routines.
This is just another Base64 implementation which uses URL safe characters; '-' for '+' and '!' for '/'.

WriterLock locks a ReaderWriterLock instance for write.


Enumeration Type Documentation

File Access Modes.

Enumerator:
accessRead 

Open the file only for read access.

accessWrite 

Open the file only for write access.

accessRW 

Open the file for read/write access.

This enumeration is used with CredentialProvider::getCredential method to specify the type of the authentication target.

See also:
CredentialProvider::getCredential, CredentialProvider
Enumerator:
authGeneral 

Unknown target.

authHttpBasic 

HTTP Basic Authentication.

authHttpProxy 

HTTP Proxy Authentication.

authPixelSafe2Local 

PixelSafe 2.X local PFZ.

authPixelSafe2 

PixelSafe 2.X (a.k.a. PADS Controller).

authPixelSafe3 

PixelSafe 3.0.

This enumeration is to define the copy policy of data.
SimpleArray uses this policy when it copies the data entries.

See also:
DataTraits, StoragePolicy, SimpleArray, DataArray
Enumerator:
noCopy 

The data is not to be copied; usually means no copy-constructor.

byConstructor 

The data should be copied by copy-constructor.

byMemcpy 

The data can be copied by std::memcpy. It actually means that the data is POD (Plain Old Data) type.

File Creation Modes.

Enumerator:
creationDefault 

Open by the default mode.

openExisting 

Open if the file exists; otherwise error.

openAlways 

Open if the file exists; otherwise create new.

createNew 

Create if the file does not exist; otherwise error.

createAlways 

Create the file always; if the file already exists, overwrite it.

truncateExisting 

Open the existing file and truncating the content; if the file does not exist, open fails.

Endian definitions

Enumerator:
endianBig 

Stands for Big-Endian.

endianLittle 

Stands for Little-Endian.

endianHost 

This constant value represents the native endian of this platform. Either of endianLittle or endianBig.

General errors.

Enumerator:
errInternalError 

General Internal Error.

errUnknown 

Errors that is not known to the system.

errSuccess 

Success.

errOutOfMemory 

Out of memory.

errBadAccess 

The access is not permitted in the current config.

errAccessDenied 

The access is denied (by permission).

errNotPermitted 

The operation is not permitted.

errAuthFailed 

Authentication failed.

errAuthRequired 

Authentication required.

errInvalidParam 

One of the parameter passed to the function is invalid.

errDivByZero 

Division by 0.

errInvalidState 

The internal status of the object is invalid.

errAlreadyExists 

The resource name has been already in use.

errNotAvailable 

The resource specified is not available now.

errNotFound 

The resource by that name (Id) is not found.

errEOF 

The pointer of the stream/storage exceeds the EOF.

errInitializationFailed 

Initialization failed.

errOpenFailed 

Some errors are occurred during opening the resource.

errReadFailed 

readBytes failed.

errWriteFailed 

writeBytes failed.

errSetPosFailed 

setPos failed.

errBufferOverFlow 

Buffer overflow, usually caused by passing small buffer.

errDataBroken 

The data is broken or unsupported structure.

errStringTooLong 

The string passed is too long.

errTypeMismatch 

Object type mismatch.

errChecksumError 

Checksum validation failed.

errProcessCanceled 

Process is canceled.

errStorageIsProtected 

The storage is PFZ.

errOperationFailed 

The requested operation is not completed.

errNotSupported 

The operation/object requested is not supported.

errNotImplemented 

The function called is not implemented.

errAssertionFailed 

For debugging purpose; assertion failed.

errSecurityValidation 

The operation violates the current security settings.

errLicenseViolation 

The operation is not permitted by license.

errCartridgeNotEnough 

Not enough cartridge to process your request.

errTooManyCartridges 

Too many cartridges installed on the system.

errTimeStampError 

Time stamp is not valid.

errTrialConfiction 

There's already a trial cartridge.

errLicenseExpired 

The license is expired.

errMachineIdMismatch 

The machine ID is different.

errNullPointer 

Null Pointer Exception.

errDataTooLarge 

Data too large.

errSemInitFailed 

Initialization of a Semaphore failed.

errMutexInitFailed 

Initialization of a Mutex failed.

errEventInitFailed 

Initialization of an Event failed.

errGateInitFailed 

Initialization of a Gate failed.

errLockFailed 

Lock failed.

errUnlockFailed 

Unlock failed.

errSignalFailed 

Sending signal failed.

errWaitFaild 

Waiting the synchronization objects failed.

errBeginThreadFailed 

The thread could be started.

errAlreadyRunning 

The thread is already running.

errNotRunning 

The thread is not running.

This enumeration defines NullString.

Proxy Types
This enumeration is used with the method HttpManager::setProxy.

Enumerator:
proxyAuto 

Use the platform's default proxy settings. The actual settings depends on the host and user ones.

proxyManual 

Use manual settings.

proxyDirect 

Use direct connection.

RegEx option flags

Enumerator:
regex_default 

Use default settings.

regex_multiline 

Processes multiline text.

regex_ignoreCase 

Case insensitive matching.

regex_longest_match 

Use longest match.

regex_ignore_empty 

Ignore empty matches.

This enumeration is to define the serialization policy of data.
DataArray uses this policy when it stores the data entries into the storage.

See also:
DataTraits, CopyPolicy, DataArray
Enumerator:
notToBeStored 

The data is not to be saved to the storage.

byCopyBytes 

The data can be directly written/read by writeBytes/readBytes methods.

bySwapCopyBytes 

The data can be written/read by writeBytes/readBytes method but byte-swapping (to deal with endianness) is required.

byClassMethods 

The data class has implements the serialize / deserialize methods of Serializable and they should be used.

Definitions of yes and no.

Enumerator:
no 

No; almost identical to false.

yes 

Yes; almost identical to true.


Function Documentation

template<size_t ALIGN, class Int >
Int Celartem::align ( Int  sz  ) 

This function aligns the value to the specified alignment.

void Celartem::cel_dbgPrintf ( const char *  format,
  ... 
)

This function works only if the _CEL_DEBUG_ symbol is not 0 and it is useful to output debug information. Please note that since this function is not stripped in the release version but only does nothing, the parameters passed to this function are evaluated even on the release code. And this may make your code run slowly. To reduce such problems, you had better quote the call to this function by if(_CEL_DEBUG_) block like as the following one:

if(_CEL_DEBUG_)
{
    cel_dbgPrintf(
        "The result is %u\n", eval(fomula));
}

This function works much like as std::printf function except it also outputs the strings to debugger view. This function is a portable version of sprintf and it does not depend on platform specific implementation. It is not affected by any locales.

Parameters:
format Format specification.
... Optional parameters.
See also:
_CEL_DEBUG_
Celartem::CEL_DEFINE_DATATRAITS ( Locker  ,
byConstructor  ,
notToBeStored   
)

Locker can be used with SimpleArray.

void Celartem::cel_printf ( const char *  format,
  ... 
)

This function works much like as std::printf function except it also outputs the strings to debugger view.
This function is a portable version of sprintf and it does not depend on platform specific implementation. It is not affected by any locales.

Parameters:
format Format specification.
... Optional parameters.
std::string Celartem::cel_printf_string ( const char *  format,
  ... 
)

This function is identical to std::sprintf except it returns std::string value. This function is a portable version of sprintf and it does not depend on platform specific implementation. It is not affected by any locales.

Parameters:
format Format specification.
... Optional parameters.
void Celartem::cel_puts ( const char *  message  ) 

This function works much like as std::fputs function except it also outputs the string to debugger view.
This function is a portable version of sprintf and it does not depend on platform specific implementation. It is not affected by any locales.

Parameters:
message Message to show.
void Celartem::cel_vprintf ( const char *  format,
std::va_list  ap 
)

This function works much like as std::vprintf function except it also outputs the string to debugger view.
This function is a portable version of sprintf and it does not depend on platform specific implementation. It is not affected by any locales.

Parameters:
format Format specification.
ap Pointer to list of parameters.
String Celartem::chr ( UChar4  chr  ) 

This function converts the specified UCS-4 character into a string.

Parameters:
chr UCS-4 character code.
Returns:
The result string.

Referenced by Celartem::Converter< CharSrc, CharDest, SrcTraits, DestTraits >::bufferSize(), and Celartem::Converter< CharSrc, CharDest, SrcTraits, DestTraits >::convert().

String Celartem::format ( const char *  inFormat,
  ... 
)

This function formats a string; the result is identical to sprintf. This method may be affected by the current locale and can be used with platform specific printf extensions.

Parameters:
inFormat String that specifies the format of parameters.
Returns:
The result string.
String Celartem::format ( const wchar_t *  inFormat,
  ... 
)

This function formats a string; the result is identical to swprintf. This method may be affected by the current locale and can be used with platform specific printf extensions.

Parameters:
inFormat String that specifies the format of parameters.
Returns:
The result string.
String Celartem::format_utf8 ( const char *  inFormat,
  ... 
)

This function is UTF-8 version of format function. It formats the string. This function is not affected by the current locale and it does not accept platform specific printf extensions.

Parameters:
inFormat String that specifies the format of parameters.
Returns:
The result string.

Referenced by Celartem::DjVu::Link::setLink().

template<class T >
T Celartem::fromBig ( const T &  num  ) 

Converts the input value that is stored in Big-Endian into the native endian. (BIG -> HOST)

Parameters:
num A value that is stored in Big-Endian.
Returns:
The result.
template<class T >
T Celartem::fromLittle ( const T &  num  ) 

Converts the input value that is stored in Little-Endian into the native endian. (LITTLE -> HOST)

Parameters:
num A value that is stored in Little-Endian.
Returns:
The result.
String Celartem::operator+ ( const utf8s &  str1,
const String &  str2 
)

This function concatenates two strings into a string.

Parameters:
str1 
str2 Strings to be combined.
Returns:
The result string.
String Celartem::operator+ ( const char *  str1,
const String &  str2 
)

This function concatenates two strings into a string.

Parameters:
str1 
str2 Strings to be combined.
Returns:
The result string.
String Celartem::operator+ ( const UChar2 *  str1,
const String &  str2 
)

This function concatenates two strings into a string.

Parameters:
str1 
str2 Strings to be combined.
Returns:
The result string.
String Celartem::operator+ ( const UChar4 *  str1,
const String &  str2 
)

This function concatenates two strings into a string.

Parameters:
str1 
str2 Strings to be combined.
Returns:
The result string.
template<class T >
T Celartem::read ( const void *CEL_RESTRICT  buffer,
Endian  endian 
)

Reads a value from the buffer in the specified endian.

Parameters:
buffer Pointer to the buffer to read from.
endian Endian in which the value is read.
Returns:
The value read (in the native endian).
template<typename T >
T Celartem::read ( Stream *  inStream,
Endian  inEndian 
)

This template function reads a value from the specified storage using DataTraits<T>::storagePolicy information.

Parameters:
inStream This parameter specifies the stream to read from.
inEndian endian used to read the value, it must be one of the following values:

  • endianHost (default) read the value using native endian.
  • endianLittle read the value using little endian.
  • endianBig read the value using big endian. This information is only used when needed.
See also:
DataTraits, read, write, writeData
Stream, Stream::readBytes, Stream::writeBytes

The following is a sample use of this function:

            uint32_t n = read<uint32_t>(inStream, endianBig);
String Celartem::repeatChar ( UChar4  chr,
size_t  count 
)

This function repeats the character and returns a new string.

Parameters:
chr UCS-4 character code to be repeated.
count Repeat count.
Returns:
The result string.
String Celartem::repeatString ( const String &  string,
size_t  count 
)

This function repeats the string and returns a new string.

Parameters:
string String to be repeated.
count Repeat count.
Returns:
The result string.
String Celartem::stringFromUnicode ( const UChar1 *  string,
size_t  length = -1 
)

This function converts the specified UTF-8 string into a new string.

Parameters:
string UTF-8 string to be converted.
count The input string length. If the value is (size_t)-1, the input string is assumed to be 0-terminated.
Returns:
The result string.
String Celartem::stringFromUnicode ( const UChar2 *  string,
size_t  length = -1 
)

This function converts the specified UTF-16 string into a new string.

Parameters:
string UTF-16 string to be converted.
count The input string length. If the value is (size_t)-1, the input string is assumed to be 0-terminated.
Returns:
The result string.
String Celartem::stringFromUnicode ( const UChar4 *  string,
size_t  length = -1 
)

This function converts the specified UTF-32 string into a new string.

Parameters:
string UTF-32 string to be converted.
count The input string length. If the value is (size_t)-1, the input string is assumed to be 0-terminated.
Returns:
The result string.
template<class T >
T Celartem::swap ( const T &  n  ) 

General version of byte swapping.

Parameters:
n A value to be swapped.
Returns:
The result.

Referenced by fromBig(), fromLittle(), toBig(), and toLittle().

template<class T >
void Celartem::swapBytes ( const void *CEL_RESTRICT  ioBuffer,
size_t  inBytes 
)

This function does endian-swap on the specified array.

Parameters:
ioBuffer Pointer to the buffer to do endian-swap.
inBytes Bytes to be processed. (Not the number of entries)
template<class T >
T Celartem::toBig ( const T &  num  ) 

Converts the input value into the Big-Endian. (HOST -> BIG)

Parameters:
num A value that is stored in the native endian.
Returns:
The result.
template<class T >
T Celartem::toLittle ( const T &  num  ) 

Converts the input value into the Little-Endian. (HOST -> LITTLE)

Parameters:
num A value that is stored in the native endian.
Returns:
The result.
template<typename T >
void Celartem::write ( Stream *  inStream,
const T &  n,
Endian  inEndian 
)

This template function writes a value into the specified storage using DataTraits<T>::storagePolicy information.

Parameters:
inStream This parameter specifies the stream to write on.
n A variable to write.
inEndian endian used to write the value, it must be one of the following values:

  • endianHost (default) write the value using native endian.
  • endianLittle write the value using little endian.
  • endianBig write the value using big endian. This information is only used when needed.
See also:
DataTraits, read
Stream, Stream::writeBytes, Stream::readBytes

The following is a sample use of this function:

            write<uint32_t>(inStream, 32, endianBig);
template<class T >
void Celartem::write ( void *CEL_RESTRICT  buffer,
t,
Endian  endian 
)

Writes a value to the buffer in the specified endian.

Parameters:
buffer Pointer to the buffer to write on.
t A value to write (in the native endian).
endian Endian in which the value is written.
template<class T >
void Celartem::writeArray ( void *CEL_RESTRICT  buffer,
T *CEL_RESTRICT  array,
size_t  count,
Endian  endian 
)

Writes values to the buffer in the specified endian.

Parameters:
buffer Pointer to the buffer to write on.
t Array of values to write (in the native endian).
endian Endian in which the value is written.

Variable Documentation

const size_t Celartem::notFound = (size_t)SSIZE_MIN [static]

Indicates "Not Found".

Since almost all String functions returns NULL or 0 for the index values that exceeds the end of the string, this value can be passed to the String functions as a valid character position.

const size_t Celartem::STR_AUTOSIZE = (size_t)SSIZE_MIN [static]

Instructs the method to check the length.


This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:17.
Caminova Logo