commit
f1a2c28ac7
@ -187,6 +187,11 @@ public:
|
|||||||
static void Free(void *ptr) { (void)ptr; } // Do nothing
|
static void Free(void *ptr) { (void)ptr; } // Do nothing
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
//! Copy constructor is not permitted.
|
||||||
|
MemoryPoolAllocator(const MemoryPoolAllocator& rhs) /* = delete */;
|
||||||
|
//! Copy assignment operator is not permitted.
|
||||||
|
MemoryPoolAllocator& operator=(const MemoryPoolAllocator& rhs) /* = delete */;
|
||||||
|
|
||||||
//! Creates a new chunk.
|
//! Creates a new chunk.
|
||||||
/*! \param capacity Capacity of the chunk in bytes.
|
/*! \param capacity Capacity of the chunk in bytes.
|
||||||
*/
|
*/
|
||||||
|
@ -642,17 +642,17 @@ private:
|
|||||||
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
|
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
|
||||||
|
|
||||||
// Initialize this value as array with initial data, without calling destructor.
|
// Initialize this value as array with initial data, without calling destructor.
|
||||||
void SetArrayRaw(GenericValue* values, SizeType count, Allocator& alloctaor) {
|
void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) {
|
||||||
flags_ = kArrayFlag;
|
flags_ = kArrayFlag;
|
||||||
data_.a.elements = (GenericValue*)alloctaor.Malloc(count * sizeof(GenericValue));
|
data_.a.elements = (GenericValue*)allocator.Malloc(count * sizeof(GenericValue));
|
||||||
memcpy(data_.a.elements, values, count * sizeof(GenericValue));
|
memcpy(data_.a.elements, values, count * sizeof(GenericValue));
|
||||||
data_.a.size = data_.a.capacity = count;
|
data_.a.size = data_.a.capacity = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Initialize this value as object with initial data, without calling destructor.
|
//! Initialize this value as object with initial data, without calling destructor.
|
||||||
void SetObjectRaw(Member* members, SizeType count, Allocator& alloctaor) {
|
void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
|
||||||
flags_ = kObjectFlag;
|
flags_ = kObjectFlag;
|
||||||
data_.o.members = (Member*)alloctaor.Malloc(count * sizeof(Member));
|
data_.o.members = (Member*)allocator.Malloc(count * sizeof(Member));
|
||||||
memcpy(data_.o.members, members, count * sizeof(Member));
|
memcpy(data_.o.members, members, count * sizeof(Member));
|
||||||
data_.o.size = data_.o.capacity = count;
|
data_.o.size = data_.o.capacity = count;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class FileStream {
|
|||||||
public:
|
public:
|
||||||
typedef char Ch; //!< Character type. Only support char.
|
typedef char Ch; //!< Character type. Only support char.
|
||||||
|
|
||||||
FileStream(FILE* fp) : fp_(fp), count_(0) { Read(); }
|
FileStream(FILE* fp) : fp_(fp), current_('\0'), count_(0) { Read(); }
|
||||||
char Peek() const { return current_; }
|
char Peek() const { return current_; }
|
||||||
char Take() { char c = current_; Read(); return c; }
|
char Take() { char c = current_; Read(); return c; }
|
||||||
size_t Tell() const { return count_; }
|
size_t Tell() const { return count_; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user