Documentation for String
Former-commit-id: caf1b5889604d7c2248ec88bde99a6bce0d7680f
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,37 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::StringStream
|
||||
* \brief Core class that represents a stream of strings
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a StringStream object by default
|
||||
*/
|
||||
|
||||
StringStream::StringStream() :
|
||||
m_bufferSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a StringStream object with a string
|
||||
*
|
||||
* \param str First value of the stream
|
||||
*/
|
||||
|
||||
StringStream::StringStream(const String& str) :
|
||||
m_bufferSize(str.GetSize())
|
||||
{
|
||||
m_strings.push_back(str);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gives a string representation
|
||||
* \return A string representation of the object where every objects of the stream has been converted with Nz::String
|
||||
*/
|
||||
|
||||
String StringStream::ToString() const
|
||||
{
|
||||
String string;
|
||||
@@ -29,6 +49,13 @@ namespace Nz
|
||||
return string;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the boolean
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param boolean Boolean value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(bool boolean)
|
||||
{
|
||||
m_strings.push_back(String::Boolean(boolean));
|
||||
@@ -37,6 +64,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the short
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Short value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(short number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -45,6 +79,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the unsigned short
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Short value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(unsigned short number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -53,6 +94,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the int
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Int value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(int number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -61,6 +109,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the unsigned int
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Int value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(unsigned int number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -69,6 +124,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the long
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Long value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -77,6 +139,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the unsigned long
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Long value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(unsigned long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -85,6 +154,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the long long
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Long long value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(long long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -93,6 +169,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the unsigned long long
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Long long value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(unsigned long long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -101,6 +184,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the float
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Float value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(float number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -109,6 +199,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the double
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Double value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(double number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -117,6 +214,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the long double
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param number Long double value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(long double number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
@@ -125,6 +229,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the char
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param character Char value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(char character)
|
||||
{
|
||||
m_strings.push_back(String(character));
|
||||
@@ -133,6 +244,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the unsigned char
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param character Char value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(unsigned char character)
|
||||
{
|
||||
m_strings.push_back(String(static_cast<char>(character)));
|
||||
@@ -141,6 +259,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the const char*
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param string String value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(const char* string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
@@ -149,6 +274,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the std::string
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param string String value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(const std::string& string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
@@ -157,6 +289,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the Nz::String
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param string String value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(const String& string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
@@ -165,6 +304,13 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the representation of the pointer
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param ptr Pointer value
|
||||
*/
|
||||
|
||||
StringStream& StringStream::operator<<(const void* ptr)
|
||||
{
|
||||
m_strings.push_back(String::Pointer(ptr));
|
||||
@@ -173,6 +319,11 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Converts this to Nz::String
|
||||
* \return The string representation of the stream
|
||||
*/
|
||||
|
||||
StringStream::operator String() const
|
||||
{
|
||||
return ToString();
|
||||
|
||||
@@ -11,20 +11,32 @@ namespace Nz
|
||||
{
|
||||
struct Character
|
||||
{
|
||||
UInt16 category; // Le type du caractère
|
||||
UInt8 direction; // Le sens de lecure du caractère
|
||||
UInt32 lowerCase; // Le caractère correspondant en minuscule
|
||||
UInt32 titleCase; // Le caractère correspondant en titre
|
||||
UInt32 upperCase; // Le caractère correspondant en majuscule
|
||||
UInt16 category; // The type of the character
|
||||
UInt8 direction; // The reading way of the character
|
||||
UInt32 lowerCase; // The corresponding lower character
|
||||
UInt32 titleCase; // The corresponding title character
|
||||
UInt32 upperCase; // The corresponding upper character
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Core/UnicodeData.hpp>
|
||||
|
||||
#else // Implémentation supportant la table ASCII
|
||||
#else // Implementation handling ASCII table
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::Unicode
|
||||
* \brief Core class that represents a Unicode character
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Gets the category of the character
|
||||
* \return Unicode category
|
||||
*
|
||||
* \param character Character to get assignated category
|
||||
*/
|
||||
|
||||
Unicode::Category Unicode::GetCategory(char32_t character)
|
||||
{
|
||||
switch (character)
|
||||
@@ -188,6 +200,13 @@ namespace Nz
|
||||
return Category_NoCategory;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the direction of reading of the character
|
||||
* \return Unicode direction
|
||||
*
|
||||
* \param character Character to get assignated direction
|
||||
*/
|
||||
|
||||
Unicode::Direction Unicode::GetDirection(char32_t character)
|
||||
{
|
||||
switch (character)
|
||||
@@ -347,6 +366,15 @@ namespace Nz
|
||||
return Direction_Boundary_Neutral;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the lower case of the character
|
||||
* \return Unicode lower
|
||||
*
|
||||
* \param character Character to get assignated lower case
|
||||
*
|
||||
* \remark Only handling ASCII
|
||||
*/
|
||||
|
||||
char32_t Unicode::GetLowercase(char32_t character)
|
||||
{
|
||||
if (character >= 'A' && character <= 'Z')
|
||||
@@ -355,11 +383,29 @@ namespace Nz
|
||||
return character;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the title case of the character
|
||||
* \return Unicode title
|
||||
*
|
||||
* \param character Character to get assignated title case
|
||||
*
|
||||
* \remark Only handling ASCII
|
||||
*/
|
||||
|
||||
char32_t Unicode::GetTitlecase(char32_t character)
|
||||
{
|
||||
return GetUppercase(character);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the upper case of the character
|
||||
* \return Unicode upper
|
||||
*
|
||||
* \param character Character to get assignated upper case
|
||||
*
|
||||
* \remark Only handling ASCII
|
||||
*/
|
||||
|
||||
char32_t Unicode::GetUppercase(char32_t character)
|
||||
{
|
||||
if (character >= 'a' && character <= 'z')
|
||||
|
||||
Reference in New Issue
Block a user