add to Space methods which takes a Stream as an argument
- Space::set(const Stream & stream) - Space::add(const Stream & stream) - Space::add(const wchar_t * field, const Stream & stream) - Space::add(const std::wstring & field, const Stream & stream)
This commit is contained in:
@@ -446,6 +446,20 @@ void Space::set(const std::wstring & str)
|
||||
value.value_wstring = str;
|
||||
}
|
||||
|
||||
void Space::set(const Stream & stream)
|
||||
{
|
||||
if( stream.is_char_stream() )
|
||||
{
|
||||
initialize_value_string_if_needed();
|
||||
stream.to_str(value.value_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
initialize_value_wstring_if_needed();
|
||||
stream.to_str(value.value_wstring);
|
||||
}
|
||||
}
|
||||
|
||||
void Space::set(const Space & space)
|
||||
{
|
||||
copy_from(space);
|
||||
@@ -567,6 +581,24 @@ Space & Space::add(const std::wstring & val)
|
||||
return add_generic(val);
|
||||
}
|
||||
|
||||
Space & Space::add(const Stream & stream)
|
||||
{
|
||||
if( stream.is_char_stream() )
|
||||
{
|
||||
pt::Space & new_item = add_empty_space();
|
||||
new_item.set_empty_string();
|
||||
stream.to_str(new_item.value.value_string);
|
||||
return new_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt::Space & new_item = add_empty_space();
|
||||
new_item.set_empty_wstring();
|
||||
stream.to_str(new_item.value.value_wstring);
|
||||
return new_item;
|
||||
}
|
||||
}
|
||||
|
||||
Space & Space::add(const Space & space)
|
||||
{
|
||||
return add_generic(space);
|
||||
@@ -690,6 +722,24 @@ Space & Space::add(const wchar_t * field, const std::wstring & val)
|
||||
return add_generic(field, val);
|
||||
}
|
||||
|
||||
Space & Space::add(const wchar_t * field, const Stream & stream)
|
||||
{
|
||||
if( stream.is_char_stream() )
|
||||
{
|
||||
pt::Space & new_item = add_empty_space(field);
|
||||
new_item.set_empty_string();
|
||||
stream.to_str(new_item.value.value_string);
|
||||
return new_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt::Space & new_item = add_empty_space(field);
|
||||
new_item.set_empty_wstring();
|
||||
stream.to_str(new_item.value.value_wstring);
|
||||
return new_item;
|
||||
}
|
||||
}
|
||||
|
||||
Space & Space::add(const wchar_t * field, const Space & space)
|
||||
{
|
||||
return add_generic(field, space);
|
||||
@@ -822,6 +872,11 @@ Space & Space::add(const std::wstring & field, const std::wstring & val)
|
||||
return add_generic_string(field, val);
|
||||
}
|
||||
|
||||
Space & Space::add(const std::wstring & field, const Stream & stream)
|
||||
{
|
||||
return add(field.c_str(), stream);
|
||||
}
|
||||
|
||||
Space & Space::add(const std::wstring & field, const Space & space)
|
||||
{
|
||||
return add_generic_string(field, space);
|
||||
|
Reference in New Issue
Block a user