Remove Nz::String and Nz::StringStream
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
#include <Nazara/Core/ResourceManager.hpp>
|
||||
#include <Nazara/Core/ResourceParameters.hpp>
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -67,23 +67,23 @@ namespace Nz
|
||||
|
||||
std::size_t GetFrameCount() const;
|
||||
std::size_t GetJointCount() const;
|
||||
Sequence* GetSequence(const String& sequenceName);
|
||||
Sequence* GetSequence(const std::string& sequenceName);
|
||||
Sequence* GetSequence(std::size_t index);
|
||||
const Sequence* GetSequence(const String& sequenceName) const;
|
||||
const Sequence* GetSequence(const std::string& sequenceName) const;
|
||||
const Sequence* GetSequence(std::size_t index) const;
|
||||
std::size_t GetSequenceCount() const;
|
||||
std::size_t GetSequenceIndex(const String& sequenceName) const;
|
||||
std::size_t GetSequenceIndex(const std::string& sequenceName) const;
|
||||
SequenceJoint* GetSequenceJoints(std::size_t frameIndex = 0);
|
||||
const SequenceJoint* GetSequenceJoints(std::size_t frameIndex = 0) const;
|
||||
AnimationType GetType() const;
|
||||
|
||||
bool HasSequence(const String& sequenceName) const;
|
||||
bool HasSequence(const std::string& sequenceName) const;
|
||||
bool HasSequence(std::size_t index = 0) const;
|
||||
|
||||
bool IsLoopPointInterpolationEnabled() const;
|
||||
bool IsValid() const;
|
||||
|
||||
void RemoveSequence(const String& sequenceName);
|
||||
void RemoveSequence(const std::string& sequenceName);
|
||||
void RemoveSequence(std::size_t index);
|
||||
|
||||
template<typename... Args> static AnimationRef New(Args&&... args);
|
||||
|
||||
@@ -64,18 +64,18 @@ namespace Nz
|
||||
const std::shared_ptr<AbstractAtlas>& GetAtlas() const;
|
||||
std::size_t GetCachedGlyphCount(unsigned int characterSize, TextStyleFlags style, float outlineThickness) const;
|
||||
std::size_t GetCachedGlyphCount() const;
|
||||
String GetFamilyName() const;
|
||||
std::string GetFamilyName() const;
|
||||
int GetKerning(unsigned int characterSize, char32_t first, char32_t second) const;
|
||||
const Glyph& GetGlyph(unsigned int characterSize, TextStyleFlags style, float outlineThickness, char32_t character) const;
|
||||
unsigned int GetGlyphBorder() const;
|
||||
unsigned int GetMinimumStepSize() const;
|
||||
const SizeInfo& GetSizeInfo(unsigned int characterSize) const;
|
||||
String GetStyleName() const;
|
||||
std::string GetStyleName() const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
bool Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, char32_t character) const;
|
||||
bool Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, const String& characterSet) const;
|
||||
bool Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, const std::string& characterSet) const;
|
||||
|
||||
void SetAtlas(const std::shared_ptr<AbstractAtlas>& atlas);
|
||||
void SetGlyphBorder(unsigned int borderSize);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#define NAZARA_FONTDATA_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -24,8 +24,8 @@ namespace Nz
|
||||
|
||||
virtual bool ExtractGlyph(unsigned int characterSize, char32_t character, TextStyleFlags style, float outlineThickness, FontGlyph* dst) = 0;
|
||||
|
||||
virtual String GetFamilyName() const = 0;
|
||||
virtual String GetStyleName() const = 0;
|
||||
virtual std::string GetFamilyName() const = 0;
|
||||
virtual std::string GetStyleName() const = 0;
|
||||
|
||||
virtual bool HasKerning() const = 0;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Nz
|
||||
{
|
||||
Int32 parent;
|
||||
Quaternionf bindOrient;
|
||||
String name;
|
||||
std::string name;
|
||||
Vector3f bindPos;
|
||||
UInt32 flags;
|
||||
UInt32 index;
|
||||
@@ -57,12 +57,12 @@ namespace Nz
|
||||
|
||||
private:
|
||||
bool Advance(bool required = true);
|
||||
void Error(const String& message);
|
||||
void Error(const std::string& message);
|
||||
bool ParseBaseframe();
|
||||
bool ParseBounds();
|
||||
bool ParseFrame();
|
||||
bool ParseHierarchy();
|
||||
void Warning(const String& message);
|
||||
void Warning(const std::string& message);
|
||||
void UnrecognizedLine(bool error = false);
|
||||
|
||||
std::vector<float> m_animatedComponents;
|
||||
@@ -70,7 +70,7 @@ namespace Nz
|
||||
std::vector<Joint> m_joints;
|
||||
Stream& m_stream;
|
||||
StreamOptionFlags m_streamFlags;
|
||||
String m_currentLine;
|
||||
std::string m_currentLine;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_frameIndex;
|
||||
unsigned int m_frameRate;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#define NAZARA_FORMATS_MD5MESHPARSER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
@@ -22,9 +22,9 @@ namespace Nz
|
||||
public:
|
||||
struct Joint
|
||||
{
|
||||
std::string name;
|
||||
Int32 parent;
|
||||
Quaternionf bindOrient;
|
||||
String name;
|
||||
Vector3f bindPos;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Nz
|
||||
std::unordered_map<std::string, Material> m_materials;
|
||||
mutable Stream* m_currentStream;
|
||||
std::string m_currentLine;
|
||||
mutable StringStream m_outputStream;
|
||||
mutable std::ostringstream m_outputStream;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_lineCount;
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Nz
|
||||
void MTLParser::Emit(const T& text) const
|
||||
{
|
||||
m_outputStream << text;
|
||||
if (m_outputStream.GetBufferSize() > 1024 * 1024)
|
||||
if (m_outputStream.rdbuf()->str().size() > 1024 * 1024)
|
||||
Flush();
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace Nz
|
||||
|
||||
inline void MTLParser::Flush() const
|
||||
{
|
||||
m_currentStream->Write(m_outputStream);
|
||||
m_outputStream.Clear();
|
||||
m_currentStream->Write(std::move(m_outputStream).str());
|
||||
m_outputStream.str({});
|
||||
}
|
||||
|
||||
inline void MTLParser::Warning(const std::string& message)
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Nz
|
||||
mutable Stream* m_currentStream;
|
||||
std::string m_currentLine;
|
||||
std::filesystem::path m_mtlLib;
|
||||
mutable StringStream m_outputStream;
|
||||
mutable std::ostringstream m_outputStream;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_lineCount;
|
||||
unsigned int m_errorCount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Formats/OBJParser.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
@@ -135,7 +136,7 @@ namespace Nz
|
||||
void OBJParser::Emit(const T& text) const
|
||||
{
|
||||
m_outputStream << text;
|
||||
if (m_outputStream.GetBufferSize() > 1024 * 1024)
|
||||
if (m_outputStream.rdbuf()->str().size() > 1024 * 1024)
|
||||
Flush();
|
||||
}
|
||||
|
||||
@@ -158,8 +159,8 @@ namespace Nz
|
||||
|
||||
inline void OBJParser::Flush() const
|
||||
{
|
||||
m_currentStream->Write(m_outputStream);
|
||||
m_outputStream.Clear();
|
||||
m_currentStream->Write(std::move(m_outputStream).str());
|
||||
m_outputStream.str({});
|
||||
}
|
||||
|
||||
inline void OBJParser::Warning(const std::string& message)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#define NAZARA_JOINT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -26,13 +26,13 @@ namespace Nz
|
||||
void EnsureSkinningMatrixUpdate() const;
|
||||
|
||||
const Matrix4f& GetInverseBindMatrix() const;
|
||||
String GetName() const;
|
||||
const std::string& GetName() const;
|
||||
Skeleton* GetSkeleton();
|
||||
const Skeleton* GetSkeleton() const;
|
||||
const Matrix4f& GetSkinningMatrix() const;
|
||||
|
||||
void SetInverseBindMatrix(const Matrix4f& matrix);
|
||||
void SetName(const String& name);
|
||||
void SetName(std::string name);
|
||||
|
||||
private:
|
||||
void InvalidateNode() override;
|
||||
@@ -40,7 +40,7 @@ namespace Nz
|
||||
|
||||
Matrix4f m_inverseBindMatrix;
|
||||
mutable Matrix4f m_skinningMatrix;
|
||||
String m_name;
|
||||
std::string m_name;
|
||||
Skeleton* m_skeleton;
|
||||
mutable bool m_skinningMatrixUpdated;
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <Nazara/Core/ResourceManager.hpp>
|
||||
#include <Nazara/Core/ResourceParameters.hpp>
|
||||
#include <Nazara/Core/ResourceSaver.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Bitset.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <functional>
|
||||
@@ -25,9 +24,9 @@ namespace Nz
|
||||
{
|
||||
inline PixelFormatDescription();
|
||||
inline PixelFormatDescription(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType);
|
||||
inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType);
|
||||
inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType);
|
||||
inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp = 0);
|
||||
inline PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType);
|
||||
inline PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType);
|
||||
inline PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp = 0);
|
||||
|
||||
inline void Clear();
|
||||
|
||||
@@ -38,6 +37,7 @@ namespace Nz
|
||||
|
||||
inline bool Validate() const;
|
||||
|
||||
std::string name;
|
||||
// Warning: Masks bit order is reversed
|
||||
Bitset<> redMask;
|
||||
Bitset<> greenMask;
|
||||
@@ -48,7 +48,6 @@ namespace Nz
|
||||
PixelFormatSubType greenType;
|
||||
PixelFormatSubType blueType;
|
||||
PixelFormatSubType alphaType;
|
||||
String name;
|
||||
UInt8 bitsPerPixel;
|
||||
};
|
||||
|
||||
@@ -71,7 +70,7 @@ namespace Nz
|
||||
static inline PixelFormatContent GetContent(PixelFormat format);
|
||||
static inline UInt8 GetBytesPerPixel(PixelFormat format);
|
||||
static inline const PixelFormatDescription& GetInfo(PixelFormat format);
|
||||
static inline const String& GetName(PixelFormat format);
|
||||
static inline const std::string& GetName(PixelFormat format);
|
||||
|
||||
static inline bool HasAlpha(PixelFormat format);
|
||||
|
||||
|
||||
@@ -25,23 +25,24 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
|
||||
inline PixelFormatDescription::PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
|
||||
name(formatName),
|
||||
content(formatContent),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType),
|
||||
name(formatName),
|
||||
bitsPerPixel(bpp)
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType) :
|
||||
inline PixelFormatDescription::PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType) :
|
||||
PixelFormatDescription(formatName, formatContent, subType, rMask, subType, gMask, subType, bMask, subType, aMask)
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp) :
|
||||
inline PixelFormatDescription::PixelFormatDescription(const std::string& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp) :
|
||||
name(formatName),
|
||||
redMask(rMask),
|
||||
greenMask(gMask),
|
||||
blueMask(bMask),
|
||||
@@ -50,8 +51,7 @@ namespace Nz
|
||||
redType(rType),
|
||||
greenType(gType),
|
||||
blueType(bType),
|
||||
alphaType(aType),
|
||||
name(formatName)
|
||||
alphaType(aType)
|
||||
{
|
||||
redMask.Reverse();
|
||||
greenMask.Reverse();
|
||||
@@ -69,7 +69,7 @@ namespace Nz
|
||||
blueMask.Clear();
|
||||
greenMask.Clear();
|
||||
redMask.Clear();
|
||||
name.Clear();
|
||||
name.clear();
|
||||
}
|
||||
|
||||
inline bool PixelFormatDescription::IsCompressed() const
|
||||
@@ -245,7 +245,7 @@ namespace Nz
|
||||
return s_pixelFormatInfos[format];
|
||||
}
|
||||
|
||||
inline const String& PixelFormatInfo::GetName(PixelFormat format)
|
||||
inline const std::string& PixelFormatInfo::GetName(PixelFormat format)
|
||||
{
|
||||
return s_pixelFormatInfos[format].name;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#define NAZARA_RICHTEXTDRAWER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/AbstractTextDrawer.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
@@ -26,7 +26,7 @@ namespace Nz
|
||||
RichTextDrawer(RichTextDrawer&& drawer);
|
||||
~RichTextDrawer();
|
||||
|
||||
BlockRef AppendText(const String& str, bool forceNewBlock = false);
|
||||
BlockRef AppendText(const std::string& str, bool forceNewBlock = false);
|
||||
|
||||
void Clear() override;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Nz
|
||||
inline const Color& GetBlockOutlineColor(std::size_t index) const;
|
||||
inline float GetBlockOutlineThickness(std::size_t index) const;
|
||||
inline TextStyleFlags GetBlockStyle(std::size_t index) const;
|
||||
inline const String& GetBlockText(std::size_t index) const;
|
||||
inline const std::string& GetBlockText(std::size_t index) const;
|
||||
|
||||
inline BlockRef GetBlock(std::size_t index);
|
||||
const Rectf& GetBounds() const override;
|
||||
@@ -77,7 +77,7 @@ namespace Nz
|
||||
inline void SetBlockOutlineColor(std::size_t index, const Color& color);
|
||||
inline void SetBlockOutlineThickness(std::size_t index, float thickness);
|
||||
inline void SetBlockStyle(std::size_t index, TextStyleFlags style);
|
||||
inline void SetBlockText(std::size_t index, String str);
|
||||
inline void SetBlockText(std::size_t index, std::string str);
|
||||
|
||||
inline void SetDefaultCharacterSize(unsigned int characterSize);
|
||||
inline void SetDefaultCharacterSpacingOffset(float offset);
|
||||
@@ -104,7 +104,7 @@ namespace Nz
|
||||
inline void ConnectFontSlots();
|
||||
inline void DisconnectFontSlots();
|
||||
bool GenerateGlyph(Glyph& glyph, char32_t character, float outlineThickness, bool lineWrap, const Font* font, const Color& color, TextStyleFlags style, float lineSpacingOffset, unsigned int characterSize, int renderOrder, int* advance) const;
|
||||
void GenerateGlyphs(const Font* font, const Color& color, TextStyleFlags style, unsigned int characterSize, const Color& outlineColor, float characterSpacingOffset, float lineSpacingOffset, float outlineThickness, const String& text) const;
|
||||
void GenerateGlyphs(const Font* font, const Color& color, TextStyleFlags style, unsigned int characterSize, const Color& outlineColor, float characterSpacingOffset, float lineSpacingOffset, float outlineThickness, const std::string& text) const;
|
||||
inline float GetLineHeight(const Block& block) const;
|
||||
inline float GetLineHeight(float lineSpacingOffset, const Font::SizeInfo& sizeInfo) const;
|
||||
inline std::size_t HandleFontAddition(const FontRef& font);
|
||||
@@ -124,9 +124,9 @@ namespace Nz
|
||||
{
|
||||
std::size_t fontIndex;
|
||||
std::size_t glyphIndex;
|
||||
std::string text;
|
||||
Color color;
|
||||
Color outlineColor;
|
||||
String text;
|
||||
TextStyleFlags style;
|
||||
float characterSpacingOffset;
|
||||
float lineSpacingOffset;
|
||||
@@ -184,7 +184,7 @@ namespace Nz
|
||||
inline Color GetOutlineColor() const;
|
||||
inline float GetOutlineThickness() const;
|
||||
inline TextStyleFlags GetStyle() const;
|
||||
inline const String& GetText() const;
|
||||
inline const std::string& GetText() const;
|
||||
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetCharacterSize(unsigned int size);
|
||||
@@ -194,7 +194,7 @@ namespace Nz
|
||||
inline void SetOutlineColor(Color color);
|
||||
inline void SetOutlineThickness(float thickness);
|
||||
inline void SetStyle(TextStyleFlags style);
|
||||
inline void SetText(const String& text);
|
||||
inline void SetText(std::string text);
|
||||
|
||||
BlockRef& operator=(const BlockRef&) = default;
|
||||
BlockRef& operator=(BlockRef&&) = default;
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Nz
|
||||
return m_blocks[index].style;
|
||||
}
|
||||
|
||||
inline const String& RichTextDrawer::GetBlockText(std::size_t index) const
|
||||
inline const std::string& RichTextDrawer::GetBlockText(std::size_t index) const
|
||||
{
|
||||
NazaraAssert(index < m_blocks.size(), "Invalid block index");
|
||||
return m_blocks[index].text;
|
||||
@@ -341,15 +341,15 @@ namespace Nz
|
||||
InvalidateGlyphs();
|
||||
}
|
||||
|
||||
inline void RichTextDrawer::SetBlockText(std::size_t index, String str)
|
||||
inline void RichTextDrawer::SetBlockText(std::size_t index, std::string str)
|
||||
{
|
||||
NazaraAssert(index < m_blocks.size(), "Invalid block index");
|
||||
|
||||
std::size_t previousLength = m_blocks[index].text.GetLength();
|
||||
std::size_t previousLength = m_blocks[index].text.size(); //< FIXME: Count Unicode glyphs
|
||||
|
||||
m_blocks[index].text = std::move(str);
|
||||
|
||||
std::size_t newLength = m_blocks[index].text.GetLength();
|
||||
std::size_t newLength = m_blocks[index].text.size(); //< FIXME: Count Unicode glyphs
|
||||
if (newLength != previousLength)
|
||||
{
|
||||
std::size_t delta = newLength - previousLength; //< Underflow allowed
|
||||
@@ -523,7 +523,7 @@ namespace Nz
|
||||
*
|
||||
* \see GetCharacterSize, GetColor, GetFont, GetStyle, SetText
|
||||
*/
|
||||
inline const String& RichTextDrawer::BlockRef::GetText() const
|
||||
inline const std::string& RichTextDrawer::BlockRef::GetText() const
|
||||
{
|
||||
return m_drawer.GetBlockText(m_blockIndex);
|
||||
}
|
||||
@@ -622,9 +622,9 @@ namespace Nz
|
||||
*
|
||||
* \see GetText, SetCharacterSize, SetColor, SetFont, SetStyle
|
||||
*/
|
||||
inline void RichTextDrawer::BlockRef::SetText(const String& text)
|
||||
inline void RichTextDrawer::BlockRef::SetText(std::string text)
|
||||
{
|
||||
m_drawer.SetBlockText(m_blockIndex, text);
|
||||
m_drawer.SetBlockText(m_blockIndex, std::move(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
#ifndef NAZARA_SEQUENCE_HPP
|
||||
#define NAZARA_SEQUENCE_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct Sequence
|
||||
{
|
||||
String name;
|
||||
std::string name;
|
||||
UInt32 firstFrame;
|
||||
UInt32 frameCount;
|
||||
UInt32 frameRate;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_SIMPLETEXTDRAWER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/AbstractTextDrawer.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
@@ -24,7 +23,7 @@ namespace Nz
|
||||
inline SimpleTextDrawer(SimpleTextDrawer&& drawer);
|
||||
~SimpleTextDrawer() = default;
|
||||
|
||||
inline void AppendText(const String& str);
|
||||
inline void AppendText(const std::string_view& str);
|
||||
|
||||
void Clear() override;
|
||||
|
||||
@@ -45,7 +44,7 @@ namespace Nz
|
||||
inline const Color& GetOutlineColor() const;
|
||||
inline float GetOutlineThickness() const;
|
||||
inline TextStyleFlags GetStyle() const;
|
||||
inline const String& GetText() const;
|
||||
inline const std::string& GetText() const;
|
||||
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
@@ -56,15 +55,15 @@ namespace Nz
|
||||
inline void SetOutlineColor(const Color& color);
|
||||
inline void SetOutlineThickness(float thickness);
|
||||
inline void SetStyle(TextStyleFlags style);
|
||||
inline void SetText(const String& str);
|
||||
inline void SetText(std::string str);
|
||||
|
||||
inline SimpleTextDrawer& operator=(const SimpleTextDrawer& drawer);
|
||||
inline SimpleTextDrawer& operator=(SimpleTextDrawer&& drawer);
|
||||
|
||||
static inline SimpleTextDrawer Draw(const String& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
|
||||
static inline SimpleTextDrawer Draw(const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
|
||||
static inline SimpleTextDrawer Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
|
||||
static inline SimpleTextDrawer Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
|
||||
static inline SimpleTextDrawer Draw(const std::string& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
|
||||
static inline SimpleTextDrawer Draw(const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
|
||||
static inline SimpleTextDrawer Draw(Font* font, const std::string& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
|
||||
static inline SimpleTextDrawer Draw(Font* font, const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
|
||||
|
||||
private:
|
||||
inline void AppendNewLine() const;
|
||||
@@ -76,7 +75,7 @@ namespace Nz
|
||||
inline void DisconnectFontSlots();
|
||||
|
||||
bool GenerateGlyph(Glyph& glyph, char32_t character, float outlineThickness, bool lineWrap, Nz::Color color, int renderOrder, int* advance) const;
|
||||
void GenerateGlyphs(const String& text) const;
|
||||
void GenerateGlyphs(const std::string_view& text) const;
|
||||
|
||||
inline float GetLineHeight(const Font::SizeInfo& sizeInfo) const;
|
||||
|
||||
@@ -102,11 +101,11 @@ namespace Nz
|
||||
mutable std::size_t m_lastSeparatorGlyph;
|
||||
mutable std::vector<Glyph> m_glyphs;
|
||||
mutable std::vector<Line> m_lines;
|
||||
std::string m_text;
|
||||
Color m_color;
|
||||
Color m_outlineColor;
|
||||
FontRef m_font;
|
||||
mutable Rectf m_bounds;
|
||||
String m_text;
|
||||
TextStyleFlags m_style;
|
||||
mutable UInt32 m_previousCharacter;
|
||||
mutable Vector2f m_drawPos;
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace Nz
|
||||
}
|
||||
|
||||
inline SimpleTextDrawer::SimpleTextDrawer(const SimpleTextDrawer& drawer) :
|
||||
m_text(drawer.m_text),
|
||||
m_color(drawer.m_color),
|
||||
m_outlineColor(drawer.m_outlineColor),
|
||||
m_text(drawer.m_text),
|
||||
m_style(drawer.m_style),
|
||||
m_colorUpdated(false),
|
||||
m_glyphUpdated(false),
|
||||
@@ -43,9 +43,9 @@ namespace Nz
|
||||
operator=(std::move(drawer));
|
||||
}
|
||||
|
||||
inline void SimpleTextDrawer::AppendText(const String& str)
|
||||
inline void SimpleTextDrawer::AppendText(const std::string_view& str)
|
||||
{
|
||||
m_text.Append(str);
|
||||
m_text.append(str);
|
||||
if (m_glyphUpdated)
|
||||
GenerateGlyphs(str);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ namespace Nz
|
||||
return m_style;
|
||||
}
|
||||
|
||||
inline const String& SimpleTextDrawer::GetText() const
|
||||
inline const std::string& SimpleTextDrawer::GetText() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
@@ -200,11 +200,11 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
inline void SimpleTextDrawer::SetText(const String& str)
|
||||
inline void SimpleTextDrawer::SetText(std::string str)
|
||||
{
|
||||
if (m_text != str)
|
||||
{
|
||||
m_text = str;
|
||||
m_text = std::move(str);
|
||||
|
||||
InvalidateGlyphs();
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color)
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color)
|
||||
{
|
||||
SimpleTextDrawer drawer;
|
||||
drawer.SetCharacterSize(characterSize);
|
||||
@@ -268,7 +268,7 @@ namespace Nz
|
||||
return drawer;
|
||||
}
|
||||
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor)
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor)
|
||||
{
|
||||
SimpleTextDrawer drawer;
|
||||
drawer.SetCharacterSize(characterSize);
|
||||
@@ -281,7 +281,7 @@ namespace Nz
|
||||
return drawer;
|
||||
}
|
||||
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color)
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(Font* font, const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color)
|
||||
{
|
||||
SimpleTextDrawer drawer;
|
||||
drawer.SetCharacterSize(characterSize);
|
||||
@@ -293,7 +293,7 @@ namespace Nz
|
||||
return drawer;
|
||||
}
|
||||
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor)
|
||||
inline SimpleTextDrawer SimpleTextDrawer::Draw(Font* font, const std::string& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor)
|
||||
{
|
||||
SimpleTextDrawer drawer;
|
||||
drawer.SetCharacterSize(characterSize);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -41,14 +42,14 @@ namespace Nz
|
||||
void Destroy();
|
||||
|
||||
const Boxf& GetAABB() const;
|
||||
Joint* GetJoint(const String& jointName);
|
||||
Joint* GetJoint(const std::string& jointName);
|
||||
Joint* GetJoint(std::size_t index);
|
||||
const Joint* GetJoint(const String& jointName) const;
|
||||
const Joint* GetJoint(const std::string& jointName) const;
|
||||
const Joint* GetJoint(std::size_t index) const;
|
||||
Joint* GetJoints();
|
||||
const Joint* GetJoints() const;
|
||||
std::size_t GetJointCount() const;
|
||||
int GetJointIndex(const String& jointName) const;
|
||||
int GetJointIndex(const std::string& jointName) const;
|
||||
|
||||
void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation);
|
||||
void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, std::size_t* indices, std::size_t indiceCount);
|
||||
|
||||
Reference in New Issue
Block a user