#include <iostream>
-#include "writer.h"
-#include "physfs/physfs_stream.h"
+#include "writer.hpp"
+#include "physfs/physfs_stream.hpp"
+#include "msg.hpp"
namespace lisp
{
Writer::~Writer()
{
if(lists.size() > 0) {
- std::cerr << "Warning: Not all sections closed in lispwriter!\n";
+ msg_warning("Not all sections closed in lispwriter");
}
if(out_owned)
delete out;
Writer::end_list(const std::string& listname)
{
if(lists.size() == 0) {
- std::cerr << "Trying to close list '" << listname
- << "', which is not open.\n";
+ msg_warning("Trying to close list '" << listname
+ << "', which is not open");
return;
}
if(lists.back() != listname) {
- std::cerr << "Warning: trying to close list '" << listname
- << "' while list '" << lists.back() << "' is open.\n";
+ msg_warning("trying to close list '" << listname
+ << "' while list '" << lists.back() << "' is open");
return;
}
lists.pop_back();
}
void
+Writer::write_float_vector(const std::string& name,
+ const std::vector<float>& value)
+{
+ indent();
+ *out << '(' << name;
+ for(std::vector<float>::const_iterator i = value.begin(); i != value.end(); ++i)
+ *out << " " << *i;
+ *out << ")\n";
+}
+
+void
Writer::indent()
{
for(int i = 0; i<indent_depth; ++i)