Don't base Value on NT_Value.

Also use std::string instead of NT_String.

Conversions to/from the internal structures will be done at the interface.
This commit is contained in:
Peter Johnson
2015-07-16 01:38:27 -07:00
committed by Peter Johnson
parent 555725a05b
commit 9906116d23
17 changed files with 870 additions and 984 deletions

View File

@@ -11,9 +11,8 @@
#include <cassert>
#include <cstddef>
#include "ntcore.h"
#include "llvm/StringRef.h"
#include "Value.h"
namespace ntimpl {
@@ -94,23 +93,17 @@ class WireEncoder {
void WriteUleb128(unsigned long val);
void WriteType(NT_Type type);
void WriteValue(const NT_Value& value);
void WriteString(const NT_String& str) {
WriteString(llvm::StringRef(str.str, str.len));
}
void WriteValue(const Value& value);
void WriteString(llvm::StringRef str);
/* Utility function to get the written size of a value (without actually
* writing it).
*/
std::size_t GetValueSize(const NT_Value& value) const;
std::size_t GetValueSize(const Value& value) const;
/* Utility function to get the written size of a string (without actually
* writing it).
*/
std::size_t GetStringSize(const NT_String& str) const {
return GetStringSize(llvm::StringRef(str.str, str.len));
}
std::size_t GetStringSize(llvm::StringRef str) const;
WireEncoder(const WireEncoder&) = delete;