Documentation for String

Former-commit-id: caf1b5889604d7c2248ec88bde99a6bce0d7680f
This commit is contained in:
Gawaboumga
2016-02-21 14:32:17 +01:00
parent c163d65da7
commit f540029825
6 changed files with 1974 additions and 60 deletions

View File

@@ -23,11 +23,11 @@ namespace Nz
public:
enum Flags
{
None = 0x00, // Mode par défaut
CaseInsensitive = 0x01, // Insensible à la casse
HandleUtf8 = 0x02, // Traite les octets comme une suite de caractères UTF-8
TrimOnlyLeft = 0x04, // Trim(med), ne coupe que la partie gauche de la chaîne
TrimOnlyRight = 0x08 // Trim(med), ne coupe que la partie droite de la chaîne
None = 0x00, // Default mode
CaseInsensitive = 0x01, // Case insensitive
HandleUtf8 = 0x02, // Considers bytes as a list of UTF-8 characters
TrimOnlyLeft = 0x04, // Trim(med), only cut the left part of the string
TrimOnlyRight = 0x08 // Trim(med), only cut the right part of the string
};
String();
@@ -71,7 +71,7 @@ namespace Nz
std::size_t FindAny(const char* string, std::intmax_t start = 0, UInt32 flags = None) const;
std::size_t FindAny(const String& string, std::intmax_t start = 0, UInt32 flags = None) const;
std::size_t FindLast(char character, std::intmax_t start = -1, UInt32 flags = None) const;
std::size_t FindLast(const char *string, std::intmax_t start = -1, UInt32 flags = None) const;
std::size_t FindLast(const char* string, std::intmax_t start = -1, UInt32 flags = None) const;
std::size_t FindLast(const String& string, std::intmax_t start = -1, UInt32 flags = None) const;
std::size_t FindLastAny(const char* string, std::intmax_t start = -1, UInt32 flags = None) const;
std::size_t FindLastAny(const String& string, std::intmax_t start = -1, UInt32 flags = None) const;

View File

@@ -7,22 +7,42 @@
namespace Nz
{
/*!
* \brief Constructs a String object with a shared string by move semantic
*
* \param sharedString Shared string to move into this
*/
inline String::String(std::shared_ptr<SharedString>&& sharedString) :
m_sharedString(std::move(sharedString))
{
}
/*!
* \brief Releases the content to the string
*/
inline void String::ReleaseString()
{
m_sharedString = std::move(GetEmptyString());
}
/*!
* \brief Constructs a SharedString object by default
*/
inline String::SharedString::SharedString() : // Special case: empty string
capacity(0),
size(0)
{
}
/*!
* \brief Constructs a SharedString object with a size
*
* \param strSize Number of characters in the string
*/
inline String::SharedString::SharedString(std::size_t strSize) :
capacity(strSize),
size(strSize),
@@ -31,6 +51,13 @@ namespace Nz
string[strSize] = '\0';
}
/*!
* \brief Constructs a SharedString object with a size and a capacity
*
* \param strSize Number of characters in the string
* \param strCapacity Capacity in characters in the string
*/
inline String::SharedString::SharedString(std::size_t strSize, std::size_t strCapacity) :
capacity(strCapacity),
size(strSize),
@@ -39,6 +66,14 @@ namespace Nz
string[strSize] = '\0';
}
/*!
* \brief Appends the string to the hash
* \return true if hash is successful
*
* \param hash Hash to append data of the file
* \param string String to hash
*/
inline bool HashAppend(AbstractHash* hash, const String& string)
{
hash->Append(reinterpret_cast<const UInt8*>(string.GetConstBuffer()), string.GetSize());
@@ -48,6 +83,13 @@ namespace Nz
namespace std
{
/*!
* \brief Specialisation of std to hash
* \return Result of the hash
*
* \param str String to hash
*/
template<>
struct hash<Nz::String>
{

View File

@@ -18,16 +18,16 @@ namespace Nz
Unicode() = delete;
~Unicode() = delete;
/*
Catégorie Unicode:
-Les valeurs de 0x01 à 0x80 indiquent la catégorie.
-Les valeurs de 0x100 à 0x10000 indiquent la sous-catégorie.
Unicode category:
-Values between 0x01 and 0x80 specify the category
-Values between 0x100 and 0x10000 specify the subcategory
*/
enum Category : UInt16
{
// Catégorie non-reconnue par Nazara
// Category not handled by Nazara
Category_NoCategory = 0,
// Lettres
// Letters
Category_Letter = 0x01, // L
Category_Letter_Lowercase = Category_Letter | 0x0100, // Ll
Category_Letter_Modifier = Category_Letter | 0x0200, // Lm
@@ -35,19 +35,19 @@ namespace Nz
Category_Letter_Titlecase = Category_Letter | 0x0800, // Lt
Category_Letter_Uppercase = Category_Letter | 0x1000, // Lu
// Marques
// Marks
Category_Mark = 0x02, // M
Category_Mark_Enclosing = Category_Mark | 0x100, // Me
Category_Mark_NonSpacing = Category_Mark | 0x200, // Mn
Category_Mark_SpacingCombining = Category_Mark | 0x400, // Mc
// Nombres
// Numbers
Category_Number = 0x04, // N
Category_Number_DecimalDigit = Category_Number | 0x100, // Nd
Category_Number_Letter = Category_Number | 0x200, // Nl
Category_Number_Other = Category_Number | 0x400, // No
// Autres
// Others
Category_Other = 0x08, // C
Category_Other_Control = Category_Other | 0x0100, // Cc
Category_Other_Format = Category_Other | 0x0200, // Cf
@@ -65,13 +65,13 @@ namespace Nz
Category_Punctuation_Open = Category_Punctuation | 0x2000, // Ps
Category_Punctuation_Other = Category_Punctuation | 0x4000, // Po
// Espacements
// Spaces
Category_Separator = 0x20, // Z
Category_Separator_Line = Category_Separator | 0x0100, // Zl
Category_Separator_Paragraph = Category_Separator | 0x0200, // Zp
Category_Separator_Space = Category_Separator | 0x0400, // Zs
// Symboles
// Symbols
Category_Symbol = 0x40, // S
Category_Symbol_Currency = Category_Symbol | 0x0100, // Sc
Category_Symbol_Math = Category_Symbol | 0x0200, // Sm