xoreos  0.0.5
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Aurora::LocString Class Reference

A localized string. More...

#include <locstring.h>

Collaboration diagram for Aurora::LocString:
Collaboration graph
[legend]

Public Member Functions

 LocString ()
 
 ~LocString ()
 
void clear ()
 
bool empty () const
 Is this localized string empty, without any strings whatsoever? More...
 
void swap (LocString &str)
 Swap the contents of the LocString with this LocString's. More...
 
uint32 getNumStrings () const
 Get the number of strings. More...
 
uint32 getID () const
 Return the string ID / StrRef. More...
 
void setID (uint32 id)
 Set the string ID / StrRef. More...
 
bool hasString (Language language, LanguageGender gender=kLanguageGenderCurrent) const
 Does the LocString have a string of this language? More...
 
const Common::UStringgetString (Language language, LanguageGender gender=kLanguageGenderCurrent) const
 Get the string of that language. More...
 
void setString (Language language, LanguageGender gender, const Common::UString &str)
 Set the string of that language. More...
 
void setString (Language language, const Common::UString &str)
 Set the string of that language (for all genders). More...
 
const Common::UStringgetStrRefString () const
 Get the string the StrRef points to. More...
 
const Common::UStringgetFirstString () const
 Get the first available string. More...
 
const Common::UStringgetString () const
 Try to get the most appropriate string. More...
 
void readString (uint32 languageID, Common::SeekableReadStream &stream)
 Read a string out of a stream. More...
 
void readLocSubString (Common::SeekableReadStream &stream)
 Read a LocSubString (substring of a LocString in game data) out of a stream. More...
 
void readLocString (Common::SeekableReadStream &stream, uint32 id, uint32 count)
 Read a LocString out of a stream. More...
 
void readLocString (Common::SeekableReadStream &stream)
 Read a LocString out of a stream. More...
 
uint32 getWrittenSize (bool withNullTerminate=false) const
 Get the size, the string table will consume after being written. More...
 
void writeLocString (Common::WriteStream &stream, bool withNullTerminate=false) const
 Write the LocString to a write stream. More...
 

Private Types

typedef std::map< uint32, Common::UStringStringMap
 

Private Member Functions

bool hasString (uint32 languageID) const
 
const Common::UStringgetString (uint32 languageID) const
 
void setString (uint32 languageID, const Common::UString &str)
 

Private Attributes

uint32 _id
 The string's ID / StrRef. More...
 
StringMap _strings
 

Detailed Description

A localized string.

Definition at line 43 of file locstring.h.

Member Typedef Documentation

◆ StringMap

Definition at line 99 of file locstring.h.

Constructor & Destructor Documentation

◆ LocString()

Aurora::LocString::LocString ( )

Definition at line 40 of file locstring.cpp.

◆ ~LocString()

Aurora::LocString::~LocString ( )

Definition at line 43 of file locstring.cpp.

Member Function Documentation

◆ clear()

void Aurora::LocString::clear ( )

Definition at line 46 of file locstring.cpp.

References _id, _strings, and Aurora::kStrRefInvalid.

Referenced by Aurora::IFOFile::clear(), Aurora::ERFFile::readDescription(), and Engines::Witcher::Campaign::unload().

Here is the caller graph for this function:

◆ empty()

bool Aurora::LocString::empty ( ) const

Is this localized string empty, without any strings whatsoever?

Definition at line 52 of file locstring.cpp.

References _id, _strings, Common::UString::empty(), getString(), and Aurora::kStrRefInvalid.

Here is the call graph for this function:

◆ getFirstString()

const Common::UString & Aurora::LocString::getFirstString ( ) const

Get the first available string.

Definition at line 115 of file locstring.cpp.

References _strings, and getStrRefString().

Referenced by getString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getID()

uint32 Aurora::LocString::getID ( ) const

Return the string ID / StrRef.

Definition at line 66 of file locstring.cpp.

References _id.

Referenced by Aurora::ERFWriter::ERFWriter().

Here is the caller graph for this function:

◆ getNumStrings()

uint32 Aurora::LocString::getNumStrings ( ) const

Get the number of strings.

Definition at line 62 of file locstring.cpp.

References _strings.

Referenced by Aurora::ERFWriter::ERFWriter().

Here is the caller graph for this function:

◆ getString() [1/3]

const Common::UString & Aurora::LocString::getString ( Language  language,
LanguageGender  gender = kLanguageGenderCurrent 
) const

◆ getString() [2/3]

const Common::UString & Aurora::LocString::getString ( ) const

Try to get the most appropriate string.

Definition at line 122 of file locstring.cpp.

References getFirstString(), getStrRefString(), hasString(), and LangMan.

Referenced by empty(), and getString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getString() [3/3]

const Common::UString & Aurora::LocString::getString ( uint32  languageID) const
private

Definition at line 87 of file locstring.cpp.

References _strings, and Aurora::kEmpty.

◆ getStrRefString()

const Common::UString & Aurora::LocString::getStrRefString ( ) const

Get the string the StrRef points to.

Definition at line 108 of file locstring.cpp.

References _id, Aurora::kEmpty, Aurora::kStrRefInvalid, and TalkMan.

Referenced by getFirstString(), and getString().

Here is the caller graph for this function:

◆ getWrittenSize()

uint32 Aurora::LocString::getWrittenSize ( bool  withNullTerminate = false) const

Get the size, the string table will consume after being written.

Definition at line 179 of file locstring.cpp.

References _strings.

Referenced by Aurora::ERFWriter::ERFWriter().

Here is the caller graph for this function:

◆ hasString() [1/2]

bool Aurora::LocString::hasString ( Language  language,
LanguageGender  gender = kLanguageGenderCurrent 
) const

Does the LocString have a string of this language?

Definition at line 74 of file locstring.cpp.

References LangMan.

Referenced by getString().

Here is the caller graph for this function:

◆ hasString() [2/2]

bool Aurora::LocString::hasString ( uint32  languageID) const
private

Definition at line 78 of file locstring.cpp.

References _strings.

◆ readLocString() [1/2]

void Aurora::LocString::readLocString ( Common::SeekableReadStream stream,
uint32  id,
uint32  count 
)

Read a LocString out of a stream.

Definition at line 165 of file locstring.cpp.

References _id, and readLocSubString().

Referenced by Aurora::GFF3Struct::getLocString(), Aurora::ERFFile::readDescription(), and readLocString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLocString() [2/2]

void Aurora::LocString::readLocString ( Common::SeekableReadStream stream)

Read a LocString out of a stream.

Definition at line 172 of file locstring.cpp.

References readLocString(), and Common::ReadStream::readUint32LE().

Here is the call graph for this function:

◆ readLocSubString()

void Aurora::LocString::readLocSubString ( Common::SeekableReadStream stream)

Read a LocSubString (substring of a LocString in game data) out of a stream.

Definition at line 159 of file locstring.cpp.

References readString(), and Common::ReadStream::readUint32LE().

Referenced by readLocString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readString()

void Aurora::LocString::readString ( uint32  languageID,
Common::SeekableReadStream stream 
)

Read a string out of a stream.

Definition at line 142 of file locstring.cpp.

References _strings, Common::kEncodingInvalid, LangMan, Common::ReadStream::readStream(), Common::readString(), and Common::ReadStream::readUint32LE().

Referenced by readLocSubString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setID()

void Aurora::LocString::setID ( uint32  id)

Set the string ID / StrRef.

Definition at line 70 of file locstring.cpp.

References _id.

◆ setString() [1/3]

void Aurora::LocString::setString ( Language  language,
LanguageGender  gender,
const Common::UString str 
)

Set the string of that language.

Definition at line 95 of file locstring.cpp.

References LangMan.

Referenced by Engines::DragonAge::Creature::createFakePC(), Engines::DragonAge2::Creature::createFakePC(), Engines::DragonAge::Campaign::readCIFStatic(), Engines::DragonAge2::Campaign::readCIFStatic(), and setString().

Here is the caller graph for this function:

◆ setString() [2/3]

void Aurora::LocString::setString ( Language  language,
const Common::UString str 
)

Set the string of that language (for all genders).

Definition at line 99 of file locstring.cpp.

References Aurora::kLanguageGenderFemale, Aurora::kLanguageGenderMale, and setString().

Here is the call graph for this function:

◆ setString() [3/3]

void Aurora::LocString::setString ( uint32  languageID,
const Common::UString str 
)
private

Definition at line 104 of file locstring.cpp.

References _strings.

◆ swap()

void Aurora::LocString::swap ( LocString str)

Swap the contents of the LocString with this LocString's.

Definition at line 56 of file locstring.cpp.

References _id, _strings, and SWAP().

Referenced by Aurora::GFF3Struct::getLocString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeLocString()

void Aurora::LocString::writeLocString ( Common::WriteStream stream,
bool  withNullTerminate = false 
) const

Write the LocString to a write stream.

Definition at line 193 of file locstring.cpp.

References _strings, Common::WriteStream::write(), Common::WriteStream::writeByte(), and Common::WriteStream::writeUint32LE().

Referenced by Aurora::ERFWriter::ERFWriter().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _id

uint32 Aurora::LocString::_id
private

The string's ID / StrRef.

Definition at line 101 of file locstring.h.

Referenced by clear(), empty(), getID(), getStrRefString(), readLocString(), setID(), and swap().

◆ _strings

StringMap Aurora::LocString::_strings
private

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