mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Value stuff compiles/links with lots of placeholder functions
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#endif
|
||||
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/detail/node.h"
|
||||
#include <set>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/detail/node_data.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
|
24
include/yaml-cpp/value/detail/node_data.h
Normal file
24
include/yaml-cpp/value/detail/node_data.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class node_data
|
||||
{
|
||||
public:
|
||||
explicit node_data(const std::string& data);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
@@ -7,6 +7,8 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/value/value.h"
|
||||
#include "yaml-cpp/value/detail/memory.h"
|
||||
#include <string>
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
@@ -17,12 +19,16 @@ namespace YAML
|
||||
template<typename T>
|
||||
inline Value::Value(const T& rhs): m_pMemory(new detail::memory_holder)
|
||||
{
|
||||
operator=(rhs);
|
||||
Assign(rhs);
|
||||
}
|
||||
|
||||
inline Value::Value(const Value& rhs): m_pNode(rhs.m_pNode), m_pMemory(rhs.m_pMemory)
|
||||
{
|
||||
}
|
||||
|
||||
inline Value::~Value()
|
||||
{
|
||||
}
|
||||
|
||||
// access
|
||||
template<typename T>
|
||||
@@ -38,12 +44,32 @@ namespace YAML
|
||||
template<typename T>
|
||||
inline Value& Value::operator=(const T& rhs)
|
||||
{
|
||||
AssignData(convert<T>(rhs));
|
||||
Assign(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void Value::Assign(const T& rhs)
|
||||
{
|
||||
AssignData(convert<T>(rhs));
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Value& Value::operator=(const std::string& rhs)
|
||||
inline void Value::Assign(const std::string& rhs)
|
||||
{
|
||||
EnsureNodeExists();
|
||||
m_pNode->set_scalar(rhs);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Value::Assign(const char * const & rhs)
|
||||
{
|
||||
EnsureNodeExists();
|
||||
m_pNode->set_scalar(rhs);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Value::Assign(char * const & rhs)
|
||||
{
|
||||
EnsureNodeExists();
|
||||
m_pNode->set_scalar(rhs);
|
||||
@@ -54,6 +80,7 @@ namespace YAML
|
||||
if(is(*this, rhs))
|
||||
return *this;
|
||||
AssignNode(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Value::EnsureNodeExists()
|
||||
@@ -81,87 +108,107 @@ namespace YAML
|
||||
// size/iterator
|
||||
inline std::size_t Value::size() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline const_iterator Value::begin() const
|
||||
{
|
||||
return const_iterator();
|
||||
}
|
||||
|
||||
inline iterator Value::begin()
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
|
||||
inline const_iterator Value::end() const
|
||||
{
|
||||
return const_iterator();
|
||||
}
|
||||
|
||||
inline iterator Value::end()
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
|
||||
// indexing
|
||||
template<typename Key>
|
||||
inline const Value Value::operator[](const Key& key) const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
inline Value Value::operator[](const Key& key)
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
inline bool Value::remove(const Key& key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline const Value Value::operator[](const Value& key) const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline Value Value::operator[](const Value& key)
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline bool Value::remove(const Value& key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline const Value Value::operator[](const char *key) const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline Value Value::operator[](const char *key)
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline bool Value::remove(const char *key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline const Value Value::operator[](char *key) const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline Value Value::operator[](char *key)
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
inline bool Value::remove(char *key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// free functions
|
||||
inline int compare(const Value& lhs, const Value& rhs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline bool operator<(const Value& lhs, const Value& rhs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool is(const Value& lhs, const Value& rhs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
17
include/yaml-cpp/value/iterator.h
Normal file
17
include/yaml-cpp/value/iterator.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
struct iterator {};
|
||||
struct const_iterator {};
|
||||
}
|
||||
|
||||
#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/iterator.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
@@ -18,8 +20,8 @@ namespace YAML
|
||||
public:
|
||||
Value();
|
||||
explicit Value(ValueType::value type);
|
||||
explicit template<typename T> Value(const T& rhs);
|
||||
explicit Value(const Value& rhs);
|
||||
template<typename T> explicit Value(const T& rhs);
|
||||
Value(const Value& rhs);
|
||||
~Value();
|
||||
|
||||
ValueType::value Type() const;
|
||||
@@ -58,13 +60,15 @@ namespace YAML
|
||||
bool remove(char *key);
|
||||
|
||||
private:
|
||||
template<typename T> void Assign(const T& rhs);
|
||||
|
||||
void EnsureNodeExists();
|
||||
void AssignData(const Value& rhs);
|
||||
void AssignNode(const Value& rhs);
|
||||
|
||||
private:
|
||||
shared_node m_pNode;
|
||||
shared_memory_holder m_pMemory;
|
||||
detail::shared_node m_pNode;
|
||||
detail::shared_memory_holder m_pMemory;
|
||||
};
|
||||
|
||||
int compare(const Value& lhs, const Value& rhs);
|
||||
|
@@ -1,2 +1,5 @@
|
||||
add_executable(parse parse.cpp)
|
||||
target_link_libraries(parse yaml-cpp)
|
||||
|
||||
add_executable(value value.cpp)
|
||||
target_link_libraries(value yaml-cpp)
|
||||
|
8
util/value.cpp
Normal file
8
util/value.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "yaml-cpp/value/value.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
YAML::Value value;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user