Click here to Skip to main content
15,885,925 members
Articles / Programming Languages / Visual C++ 10.0

Linq-To-XML Style of Node Creation for C++

Rate me:
Please Sign up or sign in to vote.
4.78/5 (14 votes)
12 Apr 2016Ms-PL11 min read 43.6K   501   29  
Linq-To-XML Node Creation for Native C++
#include "StdAfx.h"
#include "DataType.h"
#include "..\\BaseConverter.h"

using namespace Elmax;

DataType::~DataType(void)
{
}

DataType::DataType( int i )
{
	BaseConverter conv;
	conv.SetInt32(m_str, i);
}

DataType::DataType( unsigned int ui )
{
	BaseConverter conv;
	conv.SetUInt32(m_str, ui);
}

DataType::DataType( const __int64& i64 )
{
	BaseConverter conv;
	conv.SetInt64(m_str, i64);
}

DataType::DataType( const unsigned __int64& ui64 )
{
	BaseConverter conv;
	conv.SetUInt64(m_str, ui64);
}

DataType::DataType( float f )
{
	BaseConverter conv;
	conv.SetFloat(m_str, f);
}

DataType::DataType( const double& d )
{
	BaseConverter conv;
	conv.SetDouble(m_str, d);
}

DataType::DataType( const std::string& s )
{
	BaseConverter conv;
	conv.SetString(m_str, s);
}

DataType::DataType( const std::wstring& ws )
{
	m_str = ws;
}

DataType::DataType( const char* pc )
{
	BaseConverter conv;
	conv.SetString(m_str, pc);
}

DataType::DataType( const wchar_t* pwc )
{
	m_str = pwc;
}

DataType::DataType( char c )
{
	BaseConverter conv;
	conv.SetInt8(m_str, c);
}

DataType::DataType( wchar_t wc )
{
	m_str = wc;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior)
Singapore Singapore
Shao Voon is from Singapore. His interest lies primarily in computer graphics, software optimization, concurrency, security, and Agile methodologies.

In recent years, he shifted focus to software safety research. His hobby is writing a free C++ DirectX photo slideshow application which can be viewed here.

Comments and Discussions