xoreos  0.0.5
Classes | Namespaces | Macros | Functions | Variables
encoding.cpp File Reference

Utility functions for working with differing string encodings. More...

#include <cstring>
#include <cerrno>
#include <iconv.h>
#include <vector>
#include "src/common/encoding.h"
#include "src/common/error.h"
#include "src/common/scopedptr.h"
#include "src/common/singleton.h"
#include "src/common/ustring.h"
#include "src/common/memreadstream.h"
#include "src/common/writestream.h"
Include dependency graph for encoding.cpp:

Go to the source code of this file.

Classes

class  Common::ConversionManager
 A manager handling string encoding conversions. More...
 

Namespaces

 Common
 

Macros

#define ConvMan   Common::ConversionManager::instance()
 

Functions

UString Common::getEncodingName (Encoding encoding)
 Return the human readable name of an encoding. More...
 
bool Common::hasSupportEncoding (Encoding encoding)
 Do we have support for this encoding? More...
 
static uint32 Common::readFakeChar (SeekableReadStream &stream, Encoding encoding)
 
static void Common::writeFakeChar (std::vector< byte > &output, uint32 c, Encoding encoding)
 
static UString Common::createString (std::vector< byte > &output, Encoding encoding)
 
UString Common::readString (SeekableReadStream &stream, Encoding encoding)
 Read a string with the given encoding of a stream. More...
 
UString Common::readStringFixed (SeekableReadStream &stream, Encoding encoding, size_t length)
 Read length bytes as a string with the given encoding out of a stream. More...
 
UString Common::readStringLine (SeekableReadStream &stream, Encoding encoding)
 Read a line with the given encoding out of a stream. More...
 
UString Common::readString (const byte *data, size_t size, Encoding encoding)
 Read a string with the given encoding from the raw buffer. More...
 
size_t Common::writeString (WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate=true)
 Write a string into a stream with a given encoding. More...
 
void Common::writeStringFixed (WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length)
 Write a string into a stream with a given encoding and fixed length in bytes. More...
 
MemoryReadStream * Common::convertString (const UString &str, Encoding encoding, bool terminateString=true)
 Convert a string into the given encoding. More...
 
size_t Common::getBytesPerCodepoint (Encoding encoding)
 Return the number of bytes per codepoint in this encoding. More...
 
bool Common::isValidCodepoint (Encoding encoding, uint32 cp)
 Return whether the given codepoint is valid in this encoding. More...
 

Variables

static const char *const Common::kEncodingName [kEncodingMAX]
 
static const size_t Common::kEncodingGrowthFrom [kEncodingMAX]
 
static const size_t Common::kEncodingGrowthTo [kEncodingMAX]
 
static const size_t Common::kTerminatorLength [kEncodingMAX]
 

Detailed Description

Utility functions for working with differing string encodings.

Definition in file encoding.cpp.

Macro Definition Documentation

◆ ConvMan

#define ConvMan   Common::ConversionManager::instance()