summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-24 12:04:21 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-02-28 21:27:21 (GMT)
commit6a54d28e44c3e539a0f6b45a5bdd748df5ef29ca (patch)
tree3d6959f9ea74c4d55c0487f5ec762052b3b98473 /Source
parent78104bd7bca4bd9b4b7a5c17622838a33843138e (diff)
downloadCMake-6a54d28e44c3e539a0f6b45a5bdd748df5ef29ca.zip
CMake-6a54d28e44c3e539a0f6b45a5bdd748df5ef29ca.tar.gz
CMake-6a54d28e44c3e539a0f6b45a5bdd748df5ef29ca.tar.bz2
Xcode: Use proper indentation for schemes
Diffstat (limited to 'Source')
-rw-r--r--Source/cmXCodeScheme.cxx1
-rw-r--r--Source/cmXMLWriter.cxx11
-rw-r--r--Source/cmXMLWriter.h3
3 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 3c8c0b7..c2d49d8 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -47,6 +47,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
const std::string& xcProjDir)
{
cmXMLWriter xout(fout);
+ xout.SetIndentationElement(std::string(3, ' '));
xout.StartDocument();
xout.StartElement("Scheme");
diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx
index 2f50fe9..541cb3d 100644
--- a/Source/cmXMLWriter.cxx
+++ b/Source/cmXMLWriter.cxx
@@ -7,6 +7,7 @@
cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level)
: Output(output)
+ , IndentationElement(1, '\t')
, Level(level)
, ElementOpen(false)
, BreakAttrib(false)
@@ -100,10 +101,18 @@ void cmXMLWriter::FragmentFile(const char* fname)
this->Output << fin.rdbuf();
}
+void cmXMLWriter::SetIndentationElement(std::string const& element)
+{
+ this->IndentationElement = element;
+}
+
void cmXMLWriter::ConditionalLineBreak(bool condition, std::size_t indent)
{
if (condition) {
- this->Output << '\n' << std::string(indent + this->Level, '\t');
+ this->Output << '\n';
+ for (std::size_t i = 0; i < indent + this->Level; ++i) {
+ this->Output << this->IndentationElement;
+ }
}
}
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 904f73b..6d1e6b4 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -60,6 +60,8 @@ public:
void FragmentFile(const char* fname);
+ void SetIndentationElement(std::string const& element);
+
private:
cmXMLWriter(const cmXMLWriter&);
cmXMLWriter& operator=(const cmXMLWriter&);
@@ -107,6 +109,7 @@ private:
private:
std::ostream& Output;
std::stack<std::string, std::vector<std::string> > Elements;
+ std::string IndentationElement;
std::size_t Level;
bool ElementOpen;
bool BreakAttrib;