Compare commits

...

4 Commits

@ -1,10 +1,10 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010-2020 Winch Gate Property Limited
// Copyright (C) 2010-2018 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2010 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
// Copyright (C) 2010 Robert TIMM (rti) <mail@rtti.de>
// Copyright (C) 2015-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
// Copyright (C) 2015-2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@ -227,62 +227,18 @@ inline double isValidDouble (double v)
* \param str a string to transform to lower case
*/
std::string toLower ( const char *str ); // UTF-8
std::string toLower ( const std::string &str ); // UTF-8
void toLower ( char *str ); // Ascii only
std::string toLower ( const char *str );
std::string toLower ( const std::string &str );
void toLower ( char *str );
char toLower ( const char ch ); // convert only one character
/** Convert a string in upper case.
* \param a string to transform to upper case
*/
std::string toUpper ( const char *str ); // UTF-8
std::string toUpper ( const std::string &str); // UTF-8
void toUpper ( char *str); // Ascii only
std::string toUpper ( const std::string &str);
void toUpper ( char *str);
/** Convert a single character in UTF-8 to upper or lowercase.
* \param res Character is appended in UTF-8 into this string.
* \param src Character is sourced from this UTF-8 string.
* \param i Index in `str`, incremented by the number of bytes read.
*/
void appendToLower(std::string &res, const char *str, ptrdiff_t &i);
void appendToLower(std::string &res, const std::string &str, ptrdiff_t &i);
void appendToUpper(std::string &res, const char *str, ptrdiff_t &i);
void appendToUpper(std::string &res, const std::string &str, ptrdiff_t &i);
void appendToTitle(std::string &res, const char *str, ptrdiff_t &i);
void appendToTitle(std::string &res, const std::string &str, ptrdiff_t &i);
/** UTF-8 case insensitive compare */
int compareCaseInsensitive(const char *a, const char *b);
int compareCaseInsensitive(const char *a, size_t lenA, const char *b, size_t lenB);
inline int compareCaseInsensitive(const std::string &a, const std::string &b) { return compareCaseInsensitive(&a[0], a.size(), &b[0], b.size()); }
inline bool ltCaseInsensitive(const std::string &a, const std::string &b) { return compareCaseInsensitive(&a[0], a.size(), &b[0], b.size()) < 0; }
std::string toCaseInsensitive(const char *str); // UTF-8, case-insensitive toLower
std::string toCaseInsensitive(const std::string &str); // UTF-8, case-insensitive toLower
/** ASCII to lowercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space, and control characters, are replaced.
*/
std::string toLowerAscii(const std::string &str, char replacement);
void toLowerAscii(char *str, char replacement);
/** ASCII to uppercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space, and control characters, are replaced.
*/
std::string toUpperAscii(const std::string &str, char replacement);
void toUpperAscii(char *str, char replacement);
/** ASCII to lowercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space are not affected.
*/
std::string toLowerAscii(const std::string &str);
void toLowerAscii(char *str);
/** ASCII to uppercase. Useful for internal identifiers.
* Characters outside of the 7-bit ASCII space are not affected.
*/
std::string toUpperAscii(const std::string &str);
void toUpperAscii(char *str);
/**
* Convert to an hexadecimal std::string
@ -412,8 +368,8 @@ public:
Exception();
Exception(const std::string &reason);
Exception(const char *format, ...);
virtual ~Exception() NL_OVERRIDE {}
virtual const char *what() const throw() NL_OVERRIDE;
virtual ~Exception() throw() {}
virtual const char *what() const throw();
};

@ -1,8 +1,5 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010-2019 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@ -41,7 +38,7 @@ struct EFile : public EStream
EFile (const std::string& filename) : EStream( "Unknown file error in '"+filename+"'" ), Filename(filename) {}
EFile (const std::string& filename, const std::string& text, bool ) : EStream( text ), Filename(filename) {}
virtual ~EFile() NL_OVERRIDE {}
virtual ~EFile() throw() {}
std::string Filename;
};

@ -1,9 +1,6 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -81,7 +78,7 @@ struct EStream : public Exception
EStream( const IStream &f, const std::string& str );
virtual ~EStream() NL_OVERRIDE {}
virtual ~EStream() throw() {}
// May Not be Filled...
std::string StreamName;

@ -52,8 +52,8 @@ public:
/// filePath: [out] ex. /games/nel/stream/00/00/000000000..
/// hash: [in]
/// name: [in] name for debugging purposes
virtual bool getFile(std::string &filePath, const NLMISC::CHashKey &hash, const std::string &name) NL_OVERRIDE;
virtual bool getFile(std::string &filePath, const NLMISC::CHashKey &hash, const std::string &name);
public:
/// Set storage path (ex. stream/)
std::string Path;
@ -61,7 +61,7 @@ public:
/// Loads a package into the package manager (ex. http://cdn.ryzom.dev/open/stream/)
typedef std::vector<std::string> THosts;
THosts Hosts;
}; /* class CHttpPackageProvider */
} /* namespace NLMISC */

@ -41,7 +41,7 @@ CHttpPackageProvider::~CHttpPackageProvider()
// release
}
bool CHttpPackageProvider::getFile(std::string &filePath, const CHashKey &hash, const std::string &name)
bool CHttpPackageProvider::getFile(std::string &filePath, const CHashKey &hash, const std::string &name)
{
CStreamedPackage::makePath(filePath, hash);
std::string downloadUrlFile = filePath + ".lzma";

@ -1,9 +1,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -291,40 +288,40 @@ public:
explicit CObjectNumber(double value);
explicit CObjectNumber(sint64 value);
virtual const char *getTypeAsString() const NL_OVERRIDE;
virtual const char *getTypeAsString() const;
virtual bool set(const std::string& key, sint64 value) NL_OVERRIDE;
virtual bool set(const std::string& key, double value) NL_OVERRIDE;
virtual bool set(const std::string& key, const std::string&value) NL_OVERRIDE;
virtual bool set(const std::string& key, sint64 value);
virtual bool set(const std::string& key, double value);
virtual bool set(const std::string& key, const std::string&value);
virtual bool setObject(const std::string& key, CObject* value) NL_OVERRIDE;
virtual bool setObject(const std::string& key, CObject* value);
virtual CObject* clone() const NL_OVERRIDE;
virtual CObject* clone() const;
double getNumberValue() const { return m_IsInteger ? m_Value.Integer : m_Value.Number; }
sint64 getIntegerValue() const { return m_IsInteger ? m_Value.Integer : m_Value.Number; }
virtual void dump(const std::string prefix = "", uint depth = 0) const NL_OVERRIDE;
virtual void dump(const std::string prefix = "", uint depth = 0) const;
virtual bool equal(const CObject* other) const NL_OVERRIDE;
virtual bool equal(const CObject* other) const;
protected:
virtual void doSerialize(std::string& out, CSerializeContext& context) const NL_OVERRIDE;
virtual void doSerialize(std::string& out, CSerializeContext& context) const;
virtual bool doIsNumber() const NL_OVERRIDE;
virtual bool doIsNumber() const;
virtual double doToNumber() const NL_OVERRIDE;
virtual double doToNumber() const;
virtual bool doIsInteger() const NL_OVERRIDE;
virtual bool doIsInteger() const;
virtual sint64 doToInteger() const NL_OVERRIDE;
virtual sint64 doToInteger() const;
virtual std::string doToString() const NL_OVERRIDE;
virtual std::string doToString() const;
virtual void inPlaceCopyTo(CObject &dest) const NL_OVERRIDE;
virtual void inPlaceCopy(const CObjectNumber &src) NL_OVERRIDE;
virtual void inPlaceCopyTo(CObject &dest) const;
virtual void inPlaceCopy(const CObjectNumber &src);
virtual void visitInternal(IObjectVisitor &visitor) NL_OVERRIDE;
virtual void visitInternal(IObjectVisitor &visitor);
private:
bool m_IsInteger;

Loading…
Cancel
Save