Audacity 3.2.0
Classes | Typedefs | Functions | Variables
anonymous_namespace{ProjectSerializer.cpp} Namespace Reference

Classes

class  XMLTagHandlerAdapter
 

Typedefs

using UShort = std::uint16_t
 
using Int = std::int32_t
 
using Long = std::int32_t
 
using ULong = std::uint32_t
 
using LongLong = std::int64_t
 
using Length = Int
 
using Digits = Int
 

Functions

template<typename Number >
void WriteLittleEndian (MemoryStream &out, Number value)
 
template<typename Number >
void WriteBigEndian (MemoryStream &out, Number value)
 
template<typename Number >
Number ReadLittleEndian (BufferedStreamReader &in)
 
template<typename Number >
Number ReadBigEndian (BufferedStreamReader &in)
 
template<typename BaseCharType >
std::string FastStringConvert (const void *bytes, int bytesCount)
 

Variables

static const auto WriteUShort
 
static const auto WriteInt
 
static const auto WriteLong
 
static const auto WriteULong
 
static const auto WriteLongLong
 
static const auto ReadUShort
 
static const auto ReadInt
 
static const auto ReadLong
 
static const auto ReadULong
 
static const auto ReadLongLong
 
static const auto WriteLength = WriteInt
 
static const auto ReadLength = ReadInt
 
static const auto WriteDigits = WriteInt
 
static const auto ReadDigits = ReadInt
 

Typedef Documentation

◆ Digits

using anonymous_namespace{ProjectSerializer.cpp}::Digits = typedef Int

Definition at line 192 of file ProjectSerializer.cpp.

◆ Int

using anonymous_namespace{ProjectSerializer.cpp}::Int = typedef std::int32_t

Definition at line 113 of file ProjectSerializer.cpp.

◆ Length

using anonymous_namespace{ProjectSerializer.cpp}::Length = typedef Int

Definition at line 188 of file ProjectSerializer.cpp.

◆ Long

using anonymous_namespace{ProjectSerializer.cpp}::Long = typedef std::int32_t

Definition at line 115 of file ProjectSerializer.cpp.

◆ LongLong

using anonymous_namespace{ProjectSerializer.cpp}::LongLong = typedef std::int64_t

Definition at line 118 of file ProjectSerializer.cpp.

◆ ULong

using anonymous_namespace{ProjectSerializer.cpp}::ULong = typedef std::uint32_t

Definition at line 116 of file ProjectSerializer.cpp.

◆ UShort

using anonymous_namespace{ProjectSerializer.cpp}::UShort = typedef std::uint16_t

Definition at line 112 of file ProjectSerializer.cpp.

Function Documentation

◆ FastStringConvert()

template<typename BaseCharType >
std::string anonymous_namespace{ProjectSerializer.cpp}::FastStringConvert ( const void *  bytes,
int  bytesCount 
)

Definition at line 328 of file ProjectSerializer.cpp.

329{
330 constexpr int charSize = sizeof(BaseCharType);
331
332 assert(bytesCount % charSize == 0);
333
334 const auto begin = static_cast<const BaseCharType*>(bytes);
335 const auto end = begin + bytesCount / charSize;
336
337 const bool isAscii = std::all_of(
338 begin, end,
339 [](BaseCharType c)
340 { return static_cast<std::make_unsigned_t<BaseCharType>>(c) < 0x7f; });
341
342 if (isAscii)
343 return std::string(begin, end);
344
345 return std::wstring_convert<std::codecvt_utf8<BaseCharType>, BaseCharType>()
346 .to_bytes(begin, end);
347}
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References details::begin(), and details::end().

Here is the call graph for this function:

◆ ReadBigEndian()

template<typename Number >
Number anonymous_namespace{ProjectSerializer.cpp}::ReadBigEndian ( BufferedStreamReader in)

Definition at line 153 of file ProjectSerializer.cpp.

154{
155 Number result;
156 in.ReadValue(result);
157 auto begin = static_cast<unsigned char*>(static_cast<void*>(&result));
158 std::reverse(begin, begin + sizeof(result));
159 return result;
160}
BuiltinEffectsModule::Registration< Reverse > reverse

References details::begin(), and anonymous_namespace{RegisterBuiltinEffects.cpp}::reverse.

Here is the call graph for this function:

◆ ReadLittleEndian()

template<typename Number >
Number anonymous_namespace{ProjectSerializer.cpp}::ReadLittleEndian ( BufferedStreamReader in)

Definition at line 145 of file ProjectSerializer.cpp.

146{
147 Number result;
148 in.ReadValue(result);
149 return result;
150}

◆ WriteBigEndian()

template<typename Number >
void anonymous_namespace{ProjectSerializer.cpp}::WriteBigEndian ( MemoryStream out,
Number  value 
)

Definition at line 137 of file ProjectSerializer.cpp.

138{
139 auto begin = static_cast<unsigned char*>(static_cast<void*>(&value));
140 std::reverse(begin, begin + sizeof(value));
141 out.AppendData(&value, sizeof(value));
142}
void AppendData(const void *data, const size_t length)

References MemoryStream::AppendData(), details::begin(), and anonymous_namespace{RegisterBuiltinEffects.cpp}::reverse.

Here is the call graph for this function:

◆ WriteLittleEndian()

template<typename Number >
void anonymous_namespace{ProjectSerializer.cpp}::WriteLittleEndian ( MemoryStream out,
Number  value 
)

Definition at line 131 of file ProjectSerializer.cpp.

132{
133 out.AppendData(&value, sizeof(value));
134}

References MemoryStream::AppendData().

Here is the call graph for this function:

Variable Documentation

◆ ReadDigits

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadDigits = ReadInt
static

Definition at line 194 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ ReadInt

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadInt
static
Initial value:
=
IsLittleEndian() ? &ReadLittleEndian<Int> : &ReadBigEndian<Int>
bool IsLittleEndian() noexcept
Check that machine is little-endian.
Definition: MemoryX.h:368

Definition at line 176 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode(), and EnumSetting< Enum >::ReadEnum().

◆ ReadLength

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadLength = ReadInt
static

Definition at line 190 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ ReadLong

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadLong
static
Initial value:
=
IsLittleEndian() ? &ReadLittleEndian<Long> : &ReadBigEndian<Long>

Definition at line 178 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ ReadLongLong

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadLongLong
static
Initial value:
=
IsLittleEndian() ? &ReadLittleEndian<LongLong> : &ReadBigEndian<LongLong>

Definition at line 182 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ ReadULong

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadULong
static
Initial value:
=
IsLittleEndian() ? &ReadLittleEndian<ULong> : &ReadBigEndian<ULong>

Definition at line 180 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ ReadUShort

const auto anonymous_namespace{ProjectSerializer.cpp}::ReadUShort
static
Initial value:
=
IsLittleEndian() ? &ReadLittleEndian<UShort> : &ReadBigEndian<UShort>

Definition at line 174 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::Decode().

◆ WriteDigits

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteDigits = WriteInt
static

Definition at line 193 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteAttr().

◆ WriteInt

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteInt
static
Initial value:
=
IsLittleEndian() ? &WriteLittleEndian<Int> : &WriteBigEndian<Int>

Definition at line 165 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteAttr(), and EnumSetting< Enum >::WriteEnum().

◆ WriteLength

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteLength = WriteInt
static

◆ WriteLong

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteLong
static
Initial value:
=
IsLittleEndian() ? &WriteLittleEndian<Long> : &WriteBigEndian<Long>

Definition at line 167 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteAttr().

◆ WriteLongLong

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteLongLong
static
Initial value:
=
IsLittleEndian() ? &WriteLittleEndian<LongLong> : &WriteBigEndian<LongLong>

Definition at line 171 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteAttr().

◆ WriteULong

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteULong
static
Initial value:
=
IsLittleEndian() ? &WriteLittleEndian<ULong> : &WriteBigEndian<ULong>

Definition at line 169 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteAttr().

◆ WriteUShort

const auto anonymous_namespace{ProjectSerializer.cpp}::WriteUShort
static
Initial value:
=
IsLittleEndian() ? &WriteLittleEndian<UShort> : &WriteBigEndian<UShort>

Definition at line 163 of file ProjectSerializer.cpp.

Referenced by ProjectSerializer::WriteName().