From f09e4497b654af45db23d7ee2344b648bd440f94 Mon Sep 17 00:00:00 2001 From: jbeder Date: Sat, 30 May 2009 02:29:47 +0000 Subject: [PATCH] Set eol-style to native on all of the new files --- include/conversion.h | 70 +++++++++--------- src/alias.h | 70 +++++++++--------- src/conversion.cpp | 172 +++++++++++++++++++++---------------------- 3 files changed, 156 insertions(+), 156 deletions(-) diff --git a/include/conversion.h b/include/conversion.h index 12f688c..208a1ef 100644 --- a/include/conversion.h +++ b/include/conversion.h @@ -1,35 +1,35 @@ -#pragma once - -#include -#include - -namespace YAML -{ - template - struct Converter { - static bool Convert(const std::string& input, T& output); - }; - - template - bool Convert(const std::string& input, T& output) { - return Converter::Convert(input, output); - } - - // this is the one to specialize - template - inline bool Converter::Convert(const std::string& input, T& output) { - std::stringstream stream(input); - stream >> output; - return !stream.fail(); - } - - // specializations - template <> - inline bool Converter::Convert(const std::string& input, std::string& output) { - output = input; - return true; - } - - template <> - bool Converter::Convert(const std::string& input, bool& output); -} +#pragma once + +#include +#include + +namespace YAML +{ + template + struct Converter { + static bool Convert(const std::string& input, T& output); + }; + + template + bool Convert(const std::string& input, T& output) { + return Converter::Convert(input, output); + } + + // this is the one to specialize + template + inline bool Converter::Convert(const std::string& input, T& output) { + std::stringstream stream(input); + stream >> output; + return !stream.fail(); + } + + // specializations + template <> + inline bool Converter::Convert(const std::string& input, std::string& output) { + output = input; + return true; + } + + template <> + bool Converter::Convert(const std::string& input, bool& output); +} diff --git a/src/alias.h b/src/alias.h index dfe00dd..9513665 100644 --- a/src/alias.h +++ b/src/alias.h @@ -1,35 +1,35 @@ -#pragma once - -#include "content.h" - -namespace YAML -{ - class Alias : public Content - { - public: - Alias(Content *pNodeContent); - - virtual void Parse(Scanner* pScanner, const ParserState& state); - virtual void Write(std::ostream& out, int indent, bool startedLine, bool onlyOneCharOnLine); - - virtual bool GetBegin(std::vector ::const_iterator&) const; - virtual bool GetBegin(std::map ::const_iterator&) const; - virtual bool GetEnd(std::vector ::const_iterator&) const; - virtual bool GetEnd(std::map ::const_iterator&) const; - virtual Node* GetNode(unsigned) const; - virtual unsigned GetSize() const; - virtual bool IsScalar() const; - virtual bool IsMap() const; - virtual bool IsSequence() const; - - virtual bool GetScalar(std::string& s) const; - - virtual int Compare(Content *); - virtual int Compare(Scalar *); - virtual int Compare(Sequence *); - virtual int Compare(Map *); - - private: - Content* m_pRef; - }; -} +#pragma once + +#include "content.h" + +namespace YAML +{ + class Alias : public Content + { + public: + Alias(Content *pNodeContent); + + virtual void Parse(Scanner* pScanner, const ParserState& state); + virtual void Write(std::ostream& out, int indent, bool startedLine, bool onlyOneCharOnLine); + + virtual bool GetBegin(std::vector ::const_iterator&) const; + virtual bool GetBegin(std::map ::const_iterator&) const; + virtual bool GetEnd(std::vector ::const_iterator&) const; + virtual bool GetEnd(std::map ::const_iterator&) const; + virtual Node* GetNode(unsigned) const; + virtual unsigned GetSize() const; + virtual bool IsScalar() const; + virtual bool IsMap() const; + virtual bool IsSequence() const; + + virtual bool GetScalar(std::string& s) const; + + virtual int Compare(Content *); + virtual int Compare(Scalar *); + virtual int Compare(Sequence *); + virtual int Compare(Map *); + + private: + Content* m_pRef; + }; +} diff --git a/src/conversion.cpp b/src/conversion.cpp index b990314..0b34501 100644 --- a/src/conversion.cpp +++ b/src/conversion.cpp @@ -1,86 +1,86 @@ -#include "conversion.h" -#include - - -//////////////////////////////////////////////////////////////// -// Specializations for converting a string to specific types - -namespace -{ - // we're not gonna mess with the mess that is all the isupper/etc. functions - bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } - bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; } - char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; } - - std::string tolower(const std::string& str) - { - std::string s(str); - std::transform(s.begin(), s.end(), s.begin(), ToLower); - return s; - } - - template - bool IsEntirely(const std::string& str, T func) - { - for(unsigned i=0;i - bool Converter::Convert(const std::string& input, bool& b) - { - // we can't use iostream bool extraction operators as they don't - // recognize all possible values in the table below (taken from - // http://yaml.org/type/bool.html) - static const struct { - std::string truename, falsename; - } names[] = { - { "y", "n" }, - { "yes", "no" }, - { "true", "false" }, - { "on", "off" }, - }; - - if(!IsFlexibleCase(input)) - return false; - - for(unsigned i=0;i + + +//////////////////////////////////////////////////////////////// +// Specializations for converting a string to specific types + +namespace +{ + // we're not gonna mess with the mess that is all the isupper/etc. functions + bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } + bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; } + char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; } + + std::string tolower(const std::string& str) + { + std::string s(str); + std::transform(s.begin(), s.end(), s.begin(), ToLower); + return s; + } + + template + bool IsEntirely(const std::string& str, T func) + { + for(unsigned i=0;i + bool Converter::Convert(const std::string& input, bool& b) + { + // we can't use iostream bool extraction operators as they don't + // recognize all possible values in the table below (taken from + // http://yaml.org/type/bool.html) + static const struct { + std::string truename, falsename; + } names[] = { + { "y", "n" }, + { "yes", "no" }, + { "true", "false" }, + { "on", "off" }, + }; + + if(!IsFlexibleCase(input)) + return false; + + for(unsigned i=0;i