mirror of https://github.com/libAthena/athena.git
General: Remove unnecessary usages of inline
Functions defined directly in a class definition are already inline by default. Non-specialized templates are also inline by default.
This commit is contained in:
parent
40d7396f22
commit
919a74c72c
|
@ -62,7 +62,7 @@ using __IsPODType = typename std::disjunction<
|
|||
std::is_convertible<std::remove_cv_t<T>&, atVec2d&>, std::is_convertible<std::remove_cv_t<T>&, atVec3d&>,
|
||||
std::is_convertible<std::remove_cv_t<T>&, atVec4d&>>;
|
||||
template <class T>
|
||||
inline constexpr bool __IsPODType_v = __IsPODType<T>::value;
|
||||
constexpr bool __IsPODType_v = __IsPODType<T>::value;
|
||||
|
||||
template <class T>
|
||||
using __CastPODType = typename std::conditional_t<
|
||||
|
@ -78,32 +78,32 @@ using __CastPODType = typename std::conditional_t<
|
|||
std::remove_cv_t<T>>>>>>>;
|
||||
|
||||
template <Endian DNAE>
|
||||
inline uint16_t __Read16(IStreamReader& r) {
|
||||
uint16_t __Read16(IStreamReader& r) {
|
||||
return DNAE == Endian::Big ? r.readUint16Big() : r.readUint16Little();
|
||||
}
|
||||
|
||||
template <Endian DNAE>
|
||||
inline void __Write16(IStreamWriter& w, uint16_t v) {
|
||||
void __Write16(IStreamWriter& w, uint16_t v) {
|
||||
DNAE == Endian::Big ? w.writeUint16Big(v) : w.writeUint16Little(v);
|
||||
}
|
||||
|
||||
template <Endian DNAE>
|
||||
inline uint32_t __Read32(IStreamReader& r) {
|
||||
uint32_t __Read32(IStreamReader& r) {
|
||||
return DNAE == Endian::Big ? r.readUint32Big() : r.readUint32Little();
|
||||
}
|
||||
|
||||
template <Endian DNAE>
|
||||
inline void __Write32(IStreamWriter& w, uint32_t v) {
|
||||
void __Write32(IStreamWriter& w, uint32_t v) {
|
||||
DNAE == Endian::Big ? w.writeUint32Big(v) : w.writeUint32Little(v);
|
||||
}
|
||||
|
||||
template <Endian DNAE>
|
||||
inline uint64_t __Read64(IStreamReader& r) {
|
||||
uint64_t __Read64(IStreamReader& r) {
|
||||
return DNAE == Endian::Big ? r.readUint64Big() : r.readUint64Little();
|
||||
}
|
||||
|
||||
template <Endian DNAE>
|
||||
inline void __Write64(IStreamWriter& w, uint64_t v) {
|
||||
void __Write64(IStreamWriter& w, uint64_t v) {
|
||||
DNAE == Endian::Big ? w.writeUint64Big(v) : w.writeUint64Little(v);
|
||||
}
|
||||
|
||||
|
@ -795,77 +795,77 @@ __WRITE_YAML_S(atVec4f, Endian::Little) { w.writeVec4f(id.name, var); }
|
|||
__WRITE_YAML_S(atVec4d, Endian::Little) { w.writeVec4d(id.name, var); }
|
||||
|
||||
template <class Op, class T, Endian DNAE>
|
||||
inline void __Do(const PropId& id, T& var, typename Op::StreamT& s) {
|
||||
void __Do(const PropId& id, T& var, typename Op::StreamT& s) {
|
||||
Op::template Do<T, DNAE>(id, var, s);
|
||||
}
|
||||
|
||||
template <class Op, class T, Endian DNAE>
|
||||
inline void __DoSize(const PropId& id, T& var, typename Op::StreamT& s) {
|
||||
void __DoSize(const PropId& id, T& var, typename Op::StreamT& s) {
|
||||
Op::template DoSize<T, DNAE>(id, var, s);
|
||||
}
|
||||
|
||||
template <class Op, class T, class S, Endian DNAE>
|
||||
inline void __Do(const PropId& id, std::vector<T>& vector, const S& count, typename Op::StreamT& s) {
|
||||
void __Do(const PropId& id, std::vector<T>& vector, const S& count, typename Op::StreamT& s) {
|
||||
Op::template Do<T, S, DNAE>(id, vector, count, s);
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
inline void __Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) {
|
||||
void __Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) {
|
||||
Op::Do(id, buf, count, s);
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
inline void __Do(const PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) {
|
||||
void __Do(const PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) {
|
||||
Op::Do(id, str, count, s);
|
||||
}
|
||||
|
||||
template <class Op, Endian DNAE>
|
||||
inline void __Do(const PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) {
|
||||
void __Do(const PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) {
|
||||
Op::template Do<DNAE>(id, str, count, s);
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
inline void __DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) {
|
||||
void __DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) {
|
||||
Op::DoSeek(delta, whence, s);
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
inline void __DoAlign(atInt64 amount, typename Op::StreamT& s) {
|
||||
void __DoAlign(atInt64 amount, typename Op::StreamT& s) {
|
||||
Op::DoAlign(amount, s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __Read(T& obj, athena::io::IStreamReader& r) {
|
||||
void __Read(T& obj, athena::io::IStreamReader& r) {
|
||||
__Do<Read<PropType::None>, T, T::DNAEndian>({}, obj, r);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __Write(const T& obj, athena::io::IStreamWriter& w) {
|
||||
void __Write(const T& obj, athena::io::IStreamWriter& w) {
|
||||
__Do<Write<PropType::None>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __BinarySize(const T& obj, size_t& s) {
|
||||
void __BinarySize(const T& obj, size_t& s) {
|
||||
__Do<BinarySize<PropType::None>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __PropCount(const T& obj, size_t& s) {
|
||||
void __PropCount(const T& obj, size_t& s) {
|
||||
const_cast<T&>(obj).template Enumerate<PropCount<PropType::None>>(s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __ReadYaml(T& obj, athena::io::YAMLDocReader& r) {
|
||||
void __ReadYaml(T& obj, athena::io::YAMLDocReader& r) {
|
||||
obj.template Enumerate<ReadYaml<PropType::None>>(r);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __WriteYaml(const T& obj, athena::io::YAMLDocWriter& w) {
|
||||
void __WriteYaml(const T& obj, athena::io::YAMLDocWriter& w) {
|
||||
const_cast<T&>(obj).template Enumerate<WriteYaml<PropType::None>>(w);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __ReadProp(T& obj, athena::io::IStreamReader& r) {
|
||||
void __ReadProp(T& obj, athena::io::IStreamReader& r) {
|
||||
/* Read root 0xffffffff hash (hashed empty string) */
|
||||
T::DNAEndian == Endian::Big ? r.readUint32Big() : r.readUint32Little();
|
||||
atInt64 size = T::DNAEndian == Endian::Big ? r.readUint16Big() : r.readUint16Little();
|
||||
|
@ -877,17 +877,17 @@ inline void __ReadProp(T& obj, athena::io::IStreamReader& r) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline void __WriteProp(const T& obj, athena::io::IStreamWriter& w) {
|
||||
void __WriteProp(const T& obj, athena::io::IStreamWriter& w) {
|
||||
__Do<Write<PropType::CRC32>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __BinarySizeProp(const T& obj, size_t& s) {
|
||||
void __BinarySizeProp(const T& obj, size_t& s) {
|
||||
__Do<BinarySize<PropType::CRC32>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
|
||||
void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
|
||||
/* Read root 0x0 hash (hashed empty string) */
|
||||
T::DNAEndian == Endian::Big ? r.readUint64Big() : r.readUint64Little();
|
||||
atInt64 size = T::DNAEndian == Endian::Big ? r.readUint16Big() : r.readUint16Little();
|
||||
|
@ -899,12 +899,12 @@ inline void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline void __WriteProp64(const T& obj, athena::io::IStreamWriter& w) {
|
||||
void __WriteProp64(const T& obj, athena::io::IStreamWriter& w) {
|
||||
__Do<Write<PropType::CRC64>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void __BinarySizeProp64(const T& obj, size_t& s) {
|
||||
void __BinarySizeProp64(const T& obj, size_t& s) {
|
||||
__Do<BinarySize<PropType::CRC64>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
namespace athena::io {
|
||||
|
||||
template <class T>
|
||||
inline const char* __GetDNAName(const T& dna, typename std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = 0) {
|
||||
const char* __GetDNAName(const T& dna, typename std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = 0) {
|
||||
return dna.DNATypeV();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const char* __GetDNAName(const T& dna, typename std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = 0) {
|
||||
const char* __GetDNAName(const T& dna, typename std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = 0) {
|
||||
return dna.DNAType();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::string ToYAMLString(const T& dna) {
|
||||
std::string ToYAMLString(const T& dna) {
|
||||
YAMLDocWriter docWriter(__GetDNAName(dna));
|
||||
|
||||
std::string res;
|
||||
|
@ -35,7 +35,7 @@ inline std::string ToYAMLString(const T& dna) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline bool FromYAMLString(T& dna, std::string_view str) {
|
||||
bool FromYAMLString(T& dna, std::string_view str) {
|
||||
YAMLStdStringViewReaderState reader(str);
|
||||
YAMLDocReader docReader;
|
||||
yaml_parser_set_input(docReader.getParser(), (yaml_read_handler_t*)YAMLStdStringReader, &reader);
|
||||
|
@ -46,7 +46,7 @@ inline bool FromYAMLString(T& dna, std::string_view str) {
|
|||
}
|
||||
|
||||
template <class DNASubtype>
|
||||
inline bool ValidateFromYAMLString(std::string_view str) {
|
||||
bool ValidateFromYAMLString(std::string_view str) {
|
||||
YAMLStdStringViewReaderState reader(str);
|
||||
YAMLDocReader docReader;
|
||||
yaml_parser_set_input(docReader.getParser(), (yaml_read_handler_t*)YAMLStdStringReader, &reader);
|
||||
|
@ -55,7 +55,7 @@ inline bool ValidateFromYAMLString(std::string_view str) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
|
||||
bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
|
||||
YAMLDocWriter docWriter(__GetDNAName(dna));
|
||||
|
||||
yaml_emitter_set_unicode(docWriter.getEmitter(), true);
|
||||
|
@ -66,8 +66,7 @@ inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout,
|
||||
void (T::*fn)(YAMLDocWriter& out) const) {
|
||||
bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout, void (T::*fn)(YAMLDocWriter& out) const) {
|
||||
YAMLDocWriter docWriter(__GetDNAName(dna));
|
||||
|
||||
yaml_emitter_set_unicode(docWriter.getEmitter(), true);
|
||||
|
@ -78,7 +77,7 @@ inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout,
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
|
||||
bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
|
||||
YAMLDocReader docReader;
|
||||
if (!docReader.parse(&fin))
|
||||
return false;
|
||||
|
@ -87,7 +86,7 @@ inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)(YAMLDocReader& in)) {
|
||||
bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)(YAMLDocReader& in)) {
|
||||
YAMLDocReader docReader;
|
||||
if (!docReader.parse(&fin))
|
||||
return false;
|
||||
|
@ -96,7 +95,7 @@ inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)
|
|||
}
|
||||
|
||||
template <class T, typename NameT>
|
||||
inline bool MergeToYAMLFile(const T& dna, const NameT& filename) {
|
||||
bool MergeToYAMLFile(const T& dna, const NameT& filename) {
|
||||
athena::io::FileReader r(filename);
|
||||
YAMLDocWriter docWriter(__GetDNAName(dna), r.isOpen() ? &r : nullptr);
|
||||
r.close();
|
||||
|
@ -109,7 +108,7 @@ inline bool MergeToYAMLFile(const T& dna, const NameT& filename) {
|
|||
}
|
||||
|
||||
template <class DNASubtype>
|
||||
inline bool ValidateFromYAMLStream(athena::io::IStreamReader& fin) {
|
||||
bool ValidateFromYAMLStream(athena::io::IStreamReader& fin) {
|
||||
YAMLDocReader reader;
|
||||
atUint64 pos = fin.position();
|
||||
yaml_parser_set_input(reader.getParser(), (yaml_read_handler_t*)YAMLAthenaReader, &fin);
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
explicit Dir(std::string_view path);
|
||||
|
||||
std::string absolutePath() const;
|
||||
static inline std::string absolutePath(std::string_view path) { return Dir(path).absolutePath(); }
|
||||
static std::string absolutePath(std::string_view path) { return Dir(path).absolutePath(); }
|
||||
|
||||
bool isDir() const;
|
||||
static bool isDir(std::string_view dir) { return Dir(dir).isDir(); }
|
||||
|
|
|
@ -10,33 +10,33 @@ public:
|
|||
explicit FileInfo(std::string_view path = {});
|
||||
|
||||
std::string absolutePath() const;
|
||||
static inline std::string absolutePath(std::string_view lnk) { return FileInfo(lnk).absolutePath(); }
|
||||
static std::string absolutePath(std::string_view lnk) { return FileInfo(lnk).absolutePath(); }
|
||||
|
||||
std::string absoluteFilePath() const;
|
||||
static inline std::string absoluteFilePath(std::string_view path) { return FileInfo(path).absoluteFilePath(); }
|
||||
static std::string absoluteFilePath(std::string_view path) { return FileInfo(path).absoluteFilePath(); }
|
||||
|
||||
std::string filename() const;
|
||||
static inline std::string filename(std::string_view path) { return FileInfo(path).filename(); }
|
||||
static std::string filename(std::string_view path) { return FileInfo(path).filename(); }
|
||||
|
||||
std::string path() const { return m_path; }
|
||||
static inline std::string path(std::string_view path) { return FileInfo(path).path(); }
|
||||
static std::string path(std::string_view path) { return FileInfo(path).path(); }
|
||||
|
||||
std::string extension() const;
|
||||
static inline std::string extension(std::string_view path) { return FileInfo(path).extension(); }
|
||||
static std::string extension(std::string_view path) { return FileInfo(path).extension(); }
|
||||
|
||||
atUint64 size() const;
|
||||
static inline atUint64 size(std::string_view path) { return FileInfo(path).size(); }
|
||||
static atUint64 size(std::string_view path) { return FileInfo(path).size(); }
|
||||
|
||||
bool exists() const;
|
||||
static inline bool exists(std::string_view path) { return FileInfo(path).exists(); }
|
||||
static bool exists(std::string_view path) { return FileInfo(path).exists(); }
|
||||
|
||||
bool isLink() const;
|
||||
static inline bool isLink(std::string_view lnk) { return FileInfo(lnk).isLink(); }
|
||||
static bool isLink(std::string_view lnk) { return FileInfo(lnk).isLink(); }
|
||||
bool isFile() const;
|
||||
static inline bool isFile(std::string_view path) { return FileInfo(path).isFile(); }
|
||||
static bool isFile(std::string_view path) { return FileInfo(path).isFile(); }
|
||||
|
||||
bool touch() const;
|
||||
static inline bool touch(std::string_view path) { return FileInfo(path).touch(); }
|
||||
static bool touch(std::string_view path) { return FileInfo(path).touch(); }
|
||||
|
||||
private:
|
||||
std::string m_path;
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
FileReader(std::wstring_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
|
||||
virtual ~FileReader();
|
||||
|
||||
inline std::string filename() const {
|
||||
std::string filename() const {
|
||||
#if _WIN32
|
||||
return utility::wideToUtf8(m_filename);
|
||||
#else
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
inline std::wstring wfilename() const {
|
||||
std::wstring wfilename() const {
|
||||
#if _WIN32
|
||||
return m_filename;
|
||||
#else
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
void open();
|
||||
void close();
|
||||
inline bool isOpen() const { return m_fileHandle != 0; }
|
||||
bool isOpen() const { return m_fileHandle != 0; }
|
||||
bool save();
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
||||
atUint64 position() const;
|
||||
|
|
|
@ -17,14 +17,14 @@ public:
|
|||
FileWriter(std::wstring_view filename, bool overwrite = true, bool globalErr = true);
|
||||
virtual ~FileWriter();
|
||||
|
||||
inline std::string filename() const {
|
||||
std::string filename() const {
|
||||
#if _WIN32
|
||||
return utility::wideToUtf8(m_filename);
|
||||
#else
|
||||
return m_filename;
|
||||
#endif
|
||||
}
|
||||
inline std::wstring wfilename() const {
|
||||
std::wstring wfilename() const {
|
||||
#if _WIN32
|
||||
return m_filename;
|
||||
#else
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
void open(bool overwrite = true);
|
||||
void close();
|
||||
inline bool isOpen() const { return m_fileHandle != 0; }
|
||||
bool isOpen() const { return m_fileHandle != 0; }
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
||||
atUint64 position() const;
|
||||
atUint64 length() const;
|
||||
|
@ -99,8 +99,8 @@ public:
|
|||
m_position = 0;
|
||||
}
|
||||
|
||||
inline atUint64 position() const { return m_position; }
|
||||
inline atUint64 length() const { return m_deferredBuffer.size(); }
|
||||
atUint64 position() const { return m_position; }
|
||||
atUint64 length() const { return m_deferredBuffer.size(); }
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
||||
void writeUBytes(const atUint8* data, atUint64 len);
|
||||
|
||||
|
|
|
@ -137,13 +137,13 @@ template <class T>
|
|||
using __IsDNARecord =
|
||||
typename std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
|
||||
template <class T>
|
||||
inline constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
|
||||
constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
|
||||
|
||||
template <class T>
|
||||
using __IsDNAVRecord =
|
||||
typename std::disjunction<std::is_base_of<DNAV<Endian::Big>, T>, std::is_base_of<DNAV<Endian::Little>, T>>;
|
||||
template <class T>
|
||||
inline constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
|
||||
constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
|
||||
} // namespace io
|
||||
} // namespace athena
|
||||
|
||||
|
@ -163,7 +163,7 @@ std::ostream& operator<<(std::ostream& os, const athena::Endian& endian);
|
|||
template <typename First, typename... Rest>
|
||||
constexpr auto __FIRST_ARG__(First first, Rest...) { return first; }
|
||||
template <typename S, typename... Args>
|
||||
inline auto __make_args_checked__(const S& format_str, Args&&... args) {
|
||||
auto __make_args_checked__(const S& format_str, Args&&... args) {
|
||||
return fmt::internal::make_args_checked<Args...>(format_str, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,13 @@ public:
|
|||
*
|
||||
* \return Int64 The current position in the stream.
|
||||
*/
|
||||
inline atUint64 position() const { return m_position; }
|
||||
atUint64 position() const { return m_position; }
|
||||
|
||||
/*! \brief Returns whether or not the stream is at the end.
|
||||
*
|
||||
* \return bool True if at end; False otherwise.
|
||||
*/
|
||||
inline atUint64 length() const { return m_length; }
|
||||
atUint64 length() const { return m_length; }
|
||||
|
||||
/*! \brief Sets the buffer to the given one, deleting the current one.<br />
|
||||
* <b>BEWARE:</b> As this deletes the current buffer it WILL cause a loss of data
|
||||
|
|
|
@ -37,15 +37,15 @@ public:
|
|||
*
|
||||
* @return Int64 The current position in the stream.
|
||||
*/
|
||||
inline atUint64 position() const { return m_position; }
|
||||
atUint64 position() const { return m_position; }
|
||||
|
||||
/*! @brief Returns the length of the stream.
|
||||
*
|
||||
* @return Int64 The length of the stream.
|
||||
*/
|
||||
inline atUint64 length() const { return m_length; }
|
||||
atUint64 length() const { return m_length; }
|
||||
|
||||
inline bool isOpen() const { return true; }
|
||||
bool isOpen() const { return true; }
|
||||
|
||||
/** @brief Sets the buffer to the given one, deleting the current one if it owns it.<br />
|
||||
* @param data The new buffer.
|
||||
|
@ -65,12 +65,12 @@ public:
|
|||
*
|
||||
* @param filepath The path to write to.
|
||||
*/
|
||||
inline void setFilepath(const std::string& filepath) { m_filepath = filepath; }
|
||||
void setFilepath(const std::string& filepath) { m_filepath = filepath; }
|
||||
|
||||
/*! @brief
|
||||
* Returns the target file
|
||||
*/
|
||||
inline std::string filepath() const { return m_filepath; }
|
||||
std::string filepath() const { return m_filepath; }
|
||||
|
||||
/*! @brief Saves the file to the specified file.
|
||||
*
|
||||
|
|
|
@ -28,15 +28,15 @@ public:
|
|||
*
|
||||
* @return Int64 The current position in the stream.
|
||||
*/
|
||||
inline atUint64 position() const { return m_position; }
|
||||
atUint64 position() const { return m_position; }
|
||||
|
||||
/*! @brief Returns the length of the stream.
|
||||
*
|
||||
* @return Int64 The length of the stream.
|
||||
*/
|
||||
inline atUint64 length() const { return m_data.size(); }
|
||||
atUint64 length() const { return m_data.size(); }
|
||||
|
||||
inline bool isOpen() const { return true; }
|
||||
bool isOpen() const { return true; }
|
||||
|
||||
/*! @brief Obtains reference to underlying std::vector store */
|
||||
const std::vector<uint8_t>& data() const { return m_data; }
|
||||
|
|
|
@ -27,14 +27,14 @@ struct YAMLNode {
|
|||
|
||||
YAMLNode(yaml_node_type_t type) : m_type(type) {}
|
||||
|
||||
inline const YAMLNode* findMapChild(std::string_view key) const {
|
||||
const YAMLNode* findMapChild(std::string_view key) const {
|
||||
for (const auto& item : m_mapChildren)
|
||||
if (!item.first.compare(key))
|
||||
return item.second.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void assignMapChild(std::string_view key, std::unique_ptr<YAMLNode>&& node) {
|
||||
void assignMapChild(std::string_view key, std::unique_ptr<YAMLNode>&& node) {
|
||||
for (auto& item : m_mapChildren)
|
||||
if (!item.first.compare(key)) {
|
||||
item.second = std::move(node);
|
||||
|
|
|
@ -19,15 +19,15 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
inline yaml_parser_t* getParser() { return &m_parser; }
|
||||
yaml_parser_t* getParser() { return &m_parser; }
|
||||
|
||||
bool parse(athena::io::IStreamReader* reader);
|
||||
|
||||
bool ClassTypeOperation(std::function<bool(const char* dnaType)> func);
|
||||
bool ValidateClassType(const char* expectedType);
|
||||
|
||||
inline const YAMLNode* getRootNode() const { return m_rootNode.get(); }
|
||||
inline const YAMLNode* getCurNode() const { return m_subStack.empty() ? nullptr : m_subStack.back(); }
|
||||
const YAMLNode* getRootNode() const { return m_rootNode.get(); }
|
||||
const YAMLNode* getCurNode() const { return m_subStack.empty() ? nullptr : m_subStack.back(); }
|
||||
std::unique_ptr<YAMLNode> releaseRootNode() { return std::move(m_rootNode); }
|
||||
|
||||
class RecordRAII {
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
bool finish(athena::io::IStreamWriter* fout);
|
||||
|
||||
inline YAMLNode* getCurNode() const { return m_subStack.empty() ? nullptr : m_subStack.back(); }
|
||||
YAMLNode* getCurNode() const { return m_subStack.empty() ? nullptr : m_subStack.back(); }
|
||||
|
||||
class RecordRAII {
|
||||
friend class YAMLDocWriter;
|
||||
|
|
Loading…
Reference in New Issue