1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2011 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmNewLineStyle.h"
16 cmNewLineStyle::cmNewLineStyle() : NewLineStyle(Invalid)
21 bool cmNewLineStyle::IsValid() const
23 return NewLineStyle != Invalid;
27 bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
28 std::string& errorString)
30 NewLineStyle = Invalid;
32 for (size_t i = 0; i< args.size(); i++)
34 if (args[i] == "NEWLINE_STYLE")
36 size_t const styleIndex = i + 1;
37 if (args.size() > styleIndex)
39 const std::string eol = args[styleIndex];
40 if (eol == "LF" || eol == "UNIX")
45 else if (eol == "CRLF" || eol == "WIN32" || eol == "DOS")
52 errorString = "NEWLINE_STYLE sets an unknown style, only LF, "
53 "CRLF, UNIX, DOS, and WIN32 are supported";
59 errorString = "NEWLINE_STYLE must set a style: "
60 "LF, CRLF, UNIX, DOS, or WIN32";
69 const std::string cmNewLineStyle::GetCharacters() const
86 void cmNewLineStyle::SetStyle(Style style)
92 cmNewLineStyle::Style cmNewLineStyle::GetStyle() const