Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
1e687704
Commit
1e687704
authored
Sep 07, 2011
by
Jesse Beder
Browse files
Value stuff compiles/links with lots of placeholder functions
parent
248b18a2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
7 deletions
+112
-7
include/yaml-cpp/value/detail/memory.h
include/yaml-cpp/value/detail/memory.h
+1
-0
include/yaml-cpp/value/detail/node.h
include/yaml-cpp/value/detail/node.h
+1
-0
include/yaml-cpp/value/detail/node_data.h
include/yaml-cpp/value/detail/node_data.h
+24
-0
include/yaml-cpp/value/impl.h
include/yaml-cpp/value/impl.h
+50
-3
include/yaml-cpp/value/iterator.h
include/yaml-cpp/value/iterator.h
+17
-0
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+8
-4
util/CMakeLists.txt
util/CMakeLists.txt
+3
-0
util/value.cpp
util/value.cpp
+8
-0
No files found.
include/yaml-cpp/value/detail/memory.h
View file @
1e687704
...
...
@@ -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>
...
...
include/yaml-cpp/value/detail/node.h
View file @
1e687704
...
...
@@ -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
{
...
...
include/yaml-cpp/value/detail/node_data.h
0 → 100644
View file @
1e687704
#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
include/yaml-cpp/value/impl.h
View file @
1e687704
...
...
@@ -7,6 +7,8 @@
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/detail/memory.h"
#include <string>
namespace
YAML
{
...
...
@@ -17,13 +19,17 @@ 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
>
inline
const
T
Value
::
as
()
const
...
...
@@ -38,12 +44,32 @@ namespace YAML
template
<
typename
T
>
inline
Value
&
Value
::
operator
=
(
const
T
&
rhs
)
{
Assign
Data
(
convert
<
T
>
(
rhs
)
)
;
Assign
(
rhs
);
return
*
this
;
}
template
<
typename
T
>
inline
void
Value
::
Assign
(
const
T
&
rhs
)
{
AssignData
(
convert
<
T
>
(
rhs
));
}
template
<
>
inline
void
Value
::
Assign
(
const
std
::
string
&
rhs
)
{
EnsureNodeExists
();
m_pNode
->
set_scalar
(
rhs
);
}
template
<
>
inline
Value
&
Value
::
operator
=
(
const
std
::
string
&
rhs
)
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
;
}
}
...
...
include/yaml-cpp/value/iterator.h
0 → 100644
View file @
1e687704
#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
include/yaml-cpp/value/value.h
View file @
1e687704
...
...
@@ -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
);
...
...
util/CMakeLists.txt
View file @
1e687704
add_executable
(
parse parse.cpp
)
target_link_libraries
(
parse yaml-cpp
)
add_executable
(
value value.cpp
)
target_link_libraries
(
value yaml-cpp
)
util/value.cpp
0 → 100644
View file @
1e687704
#include "yaml-cpp/value/value.h"
int
main
()
{
YAML
::
Value
value
;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment