2014-04-20 09:14:15 +00:00
|
|
|
|
// This file is part of libAthena.
|
2013-02-16 18:28:30 +00:00
|
|
|
|
//
|
2014-04-20 09:14:15 +00:00
|
|
|
|
// libAthena is free software: you can redistribute it and/or modify
|
2013-02-16 18:28:30 +00:00
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
2014-04-20 09:14:15 +00:00
|
|
|
|
// libAthena is distributed in the hope that it will be useful,
|
2013-02-16 18:28:30 +00:00
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2014-04-20 09:14:15 +00:00
|
|
|
|
// along with libAthena. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
|
|
2013-02-16 18:28:30 +00:00
|
|
|
|
|
2013-01-26 20:19:24 +00:00
|
|
|
|
#ifndef __UTILITY_H__
|
|
|
|
|
#define __UTILITY_H__
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2013-09-09 03:36:54 +00:00
|
|
|
|
#include <vector>
|
2013-01-26 20:19:24 +00:00
|
|
|
|
#include "Types.hpp"
|
|
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
|
namespace Athena
|
2013-07-22 03:06:54 +00:00
|
|
|
|
{
|
|
|
|
|
namespace utility
|
|
|
|
|
{
|
|
|
|
|
bool isEmpty(Int8*, Uint32);
|
|
|
|
|
|
|
|
|
|
Uint16 swapU16(Uint16 val );
|
2013-09-09 03:36:54 +00:00
|
|
|
|
Int16 swap16 (Int16 val );
|
|
|
|
|
Uint32 swapU32(Uint32 val);
|
|
|
|
|
Int32 swap32 (Int32 val );
|
2013-07-22 03:06:54 +00:00
|
|
|
|
Uint64 swapU64(Uint64 val);
|
|
|
|
|
Int64 swap64 (Int64 val);
|
2013-01-26 20:19:24 +00:00
|
|
|
|
|
2013-07-21 03:57:20 +00:00
|
|
|
|
float swapFloat(float val);
|
|
|
|
|
double swapDouble(double val);
|
2013-01-26 20:19:24 +00:00
|
|
|
|
|
2013-02-16 18:28:30 +00:00
|
|
|
|
bool isSystemBigEndian();
|
|
|
|
|
|
|
|
|
|
void fillRandom(Uint8 * rndArea, Uint8 count);
|
2013-01-26 20:19:24 +00:00
|
|
|
|
|
2013-09-09 03:36:54 +00:00
|
|
|
|
std::vector<std::string> split(const std::string &s, char delim);
|
2014-01-19 04:01:31 +00:00
|
|
|
|
std::string join(const std::vector<std::string>& elems, const std::string& delims);
|
2013-09-09 03:36:54 +00:00
|
|
|
|
void tolower(std::string& str);
|
|
|
|
|
void toupper(std::string& str);
|
2014-04-20 09:14:15 +00:00
|
|
|
|
std::string stdsprintf(const char* fmt, ...);
|
2014-01-11 18:27:29 +00:00
|
|
|
|
bool parseBool(const std::string& boolean, bool* valid = NULL);
|
2013-09-09 03:36:54 +00:00
|
|
|
|
|
2014-01-10 21:13:06 +00:00
|
|
|
|
int countChar(const std::string& str, const char chr, int* lastOccur = NULL);
|
2013-09-09 03:36:54 +00:00
|
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
|
Uint64 fileSize(FILE* f);
|
2013-07-22 03:06:54 +00:00
|
|
|
|
} // utility
|
2014-04-20 09:14:15 +00:00
|
|
|
|
} // Athena
|
2013-01-26 20:19:24 +00:00
|
|
|
|
#endif
|