summaryrefslogtreecommitdiff
path: root/cpp/src/slice2js/Gen.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-01-14 09:22:33 +0100
committerJose <jose@zeroc.com>2015-01-14 09:22:33 +0100
commit195454df0895051579cd83d6e64d2308a8f42c16 (patch)
tree6527548e026a929f410aef51ad467b26c4e8bf2c /cpp/src/slice2js/Gen.cpp
parentFix another bug with hello demos. (diff)
downloadice-195454df0895051579cd83d6e64d2308a8f42c16.tar.bz2
ice-195454df0895051579cd83d6e64d2308a8f42c16.tar.xz
ice-195454df0895051579cd83d6e64d2308a8f42c16.zip
JavaScript updates to use gulp and add npm and bower packages
Diffstat (limited to 'cpp/src/slice2js/Gen.cpp')
-rw-r--r--cpp/src/slice2js/Gen.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp
index 5f13813a3de..c569568c385 100644
--- a/cpp/src/slice2js/Gen.cpp
+++ b/cpp/src/slice2js/Gen.cpp
@@ -573,7 +573,8 @@ Slice::JsVisitor::writeDocComment(const ContainedPtr& p, const string& deprecate
Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& dir, bool icejs) :
_includePaths(includePaths),
- _icejs(icejs)
+ _icejs(icejs),
+ _useStdout(false)
{
_fileBase = base;
string::size_type pos = base.find_last_of("/\\");
@@ -581,13 +582,14 @@ Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const st
{
_fileBase = base.substr(pos + 1);
}
+
string file = _fileBase + ".js";
if(!dir.empty())
{
file = dir + '/' + file;
}
-
+
_out.open(file.c_str());
if(!_out)
{
@@ -596,14 +598,32 @@ Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const st
throw FileException(__FILE__, __LINE__, os.str());
}
FileTracker::instance()->addFile(file);
+
+
printHeader();
+ printGeneratedHeader(_out, _fileBase + ".ice");
+}
+Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& dir, bool icejs, ostream& out) :
+ _out(out),
+ _includePaths(includePaths),
+ _icejs(icejs),
+ _useStdout(true)
+{
+ _fileBase = base;
+ string::size_type pos = base.find_last_of("/\\");
+ if(pos != string::npos)
+ {
+ _fileBase = base.substr(pos + 1);
+ }
+
+ printHeader();
printGeneratedHeader(_out, _fileBase + ".ice");
}
Slice::Gen::~Gen()
{
- if(_out.isOpen())
+ if(_out.isOpen() || _useStdout)
{
_out << '\n';
}