summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51b3593)
raw | patch | inline | side by side (parent: 51b3593)
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Tue, 8 Nov 2011 09:08:11 +0000 (09:08 +0000) | ||
committer | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Tue, 8 Nov 2011 09:08:11 +0000 (09:08 +0000) |
alien.cc | patch | blob | history | |
alien.h | patch | blob | history | |
fold.cc | patch | blob | history | |
fold.h | patch | blob | history | |
odcread.cc | patch | blob | history | |
store.cc | patch | blob | history | |
store.h | patch | blob | history | |
textmodel.cc | patch | blob | history | |
textmodel.h | patch | blob | history |
diff --git a/alien.cc b/alien.cc
index 49d19fe5c9b06829bdc8deac3a688890da957b78..fddd2024dbcb0dfd2ee200c52b3b93170f8c6a54 100644 (file)
--- a/alien.cc
+++ b/alien.cc
return std::string("AlienPiece");
}
-AlienPart::AlienPart(Store * const _store): store(_store) {}
+std::string AlienPiece::toPlainText() {
+ return std::string();
+}
+
+AlienPart::AlienPart(Store * const store): d_store(store) {}
std::string AlienPart::toString() {
- if (store != 0)
- return store->toString();
+ if (d_store != 0)
+ return d_store->toString();
else
return "NULL";
}
+std::string AlienPart::toPlainText() {
+ if (d_store != 0)
+ return d_store->toPlainText();
+ else
+ return std::string();
+}
+
Alien::Alien(INTEGER id, const TypePath &path): Store(id), d_path(path), d_comps() {}
std::vector<AlienComponent*> & Alien::getComponents() {
return sofar + "}";
}
+std::string Alien::toPlainText() {
+ std::string sofar = std::string();
+ for (int i = 0; i < d_comps.size(); ++i) {
+ sofar += d_comps[i]->toPlainText();
+ }
+ return sofar;
+}
+
}
index 0c4b51dd4e810eb0c52b175a26469cb0e146c999..7447f953cc9ec3e4ee9b987853cb4b94f1629d9f 100644 (file)
--- a/alien.h
+++ b/alien.h
*/
struct AlienComponent {
virtual std::string toString() = 0;
+ virtual std::string toPlainText() = 0;
};
/**
AlienPiece(const char * const data, const size_t len);
virtual std::string toString();
+ virtual std::string toPlainText();
};
/**
* Store component of an alien store
*/
struct AlienPart : public AlienComponent {
- Store * const store;
+ Store * const d_store;
- AlienPart(Store * const _store);
+ AlienPart(Store * const store);
virtual std::string toString();
+ virtual std::string toPlainText();
};
class Alien : public Store {
// comps-: AlienComp (** the constituent components of this alien store **)
virtual std::string toString();
+ virtual std::string toPlainText();
};
}
index b416401ede108ab39c71e3c7ab11c64de0560a00..ae4d016cfd3d602bfadc9c0318ea212dec6f88c7 100644 (file)
--- a/fold.cc
+++ b/fold.cc
if (d_hidden == 0) {
return std::string("Fold(right)");
}
- return std::string("Fold(left)") + std::string(" { ") + d_hidden->toString() + std::string(" }");
+ return std::string("Fold(left) \"") + std::string(d_label) + std::string("\" { ") + d_hidden->toString() + std::string(" }");
+}
+
+std::string Fold::toPlainText() {
+ if (d_hidden == 0) {
+ return std::string();
+ }
+ return std::string(d_label) + std::string("\n") + d_hidden->toPlainText();
}
} // namespace odc
index 78eaa4e004aafb20da4f18afaa96796374b20b86..e53e06d08ce1ee65d41128610b8101d6126f21cf 100644 (file)
--- a/fold.h
+++ b/fold.h
virtual void internalize(Reader &reader);
virtual std::string toString();
+ virtual std::string toPlainText();
};
}
diff --git a/odcread.cc b/odcread.cc
index 6d506685882012eef28356b70f36ef21e8fd51cb..151c86181db470156f3c31c3154bafc0255d8941 100644 (file)
--- a/odcread.cc
+++ b/odcread.cc
}
std::ifstream in(argv[1], std::ios::in | std::ios::binary);
odc::Store* s = odc::importDocument(in);
- std::cout << std::endl << std::endl;
+// std::cout << s->toPlainText() << std::endl;
+// std::cout << std::endl << std::endl;
std::cout << s->toString() << std::endl;
- std::cout << in.tellg() << " " << in.eof() << std::endl;
+// std::cout << in.tellg() << " " << in.eof() << std::endl;
- odc::TypePath path;
- odc::ContainerModel(0).getTypePath(&path);
- std::cout << path.toString() << std::endl;
+// odc::TypePath path;
+// odc::ContainerModel(0).getTypePath(&path);
+// std::cout << path.toString() << std::endl;
return 0;
}
diff --git a/store.cc b/store.cc
index c2fd5b4d8696e62da10f8b04b6d4e08488a2a003..d03467cf64df6a8736cdc81ba86d34462293aeb9 100644 (file)
--- a/store.cc
+++ b/store.cc
return getTypeName();
}
+std::string Store::toPlainText() {
+ return std::string();
+}
+
const std::string Elem::TYPENAME("Stores.Elem^");
const TypeProxy<Elem> Elem::PROXY;
index da8434060bf2af7999e2440fb45e85fb33efaef6..66e58b0cae59d4dd6d0d093c5cccbcf1d3d74b71 100644 (file)
--- a/store.h
+++ b/store.h
// FIXME
virtual std::string toString();
+ virtual std::string toPlainText();
private:
void calcTypePath(TypePath * out, const std::string &name) const;
diff --git a/textmodel.cc b/textmodel.cc
index 81ac03dfe725872d202f4efec16d8243b8802a27..977bd447e35ecca8efd0b71617597f709577771b 100644 (file)
--- a/textmodel.cc
+++ b/textmodel.cc
return sofar + "}";
}
+std::string StdTextModel::toPlainText() {
+ std::string sofar = "";
+ for (int i = 0; i < d_pieces.size(); ++i) {
+ sofar += d_pieces[i]->toPlainText();
+ }
+ return sofar;
+}
+
TextPiece::TextPiece(size_t len): d_len(len) {}
LongPiece::LongPiece(size_t len): TextPiece(len) {}
return std::string("LongPiece(FIXME)");// + std::wstring((wchar_t*)d_buf) + std::string(")");
}
+std::string LongPiece::toPlainText() {
+ return std::string("FIXME");// + std::wstring((wchar_t*)d_buf) + std::string(")");
+}
+
ShortPiece::ShortPiece(size_t len): TextPiece(len) {}
ShortPiece::~ShortPiece() {
return std::string("ShortPiece(") + std::string(d_buf) + std::string(")");
}
+std::string ShortPiece::toPlainText() {
+ return std::string(d_buf);
+}
+
ViewPiece::ViewPiece(Store *view): TextPiece(0), d_view(view) {}
void ViewPiece::read(Reader &reader) {
return std::string("ViewPiece { ") + d_view->toString() + " }";
}
+std::string ViewPiece::toPlainText() {
+ return d_view->toPlainText();
+}
+
} // namespace odc
diff --git a/textmodel.h b/textmodel.h
index 9cab44db5d1c115f280980522af8ede7b98394f2..38eb7c55b73d0546c5884263a98e2ec01d53b474 100644 (file)
--- a/textmodel.h
+++ b/textmodel.h
TextPiece(size_t len);
virtual void read(Reader &reader) = 0;
virtual std::string toString() = 0;
+ virtual std::string toPlainText() = 0;
};
class LongPiece : public TextPiece {
~LongPiece();
virtual void read(Reader &reader);
virtual std::string toString();
+ virtual std::string toPlainText();
};
class ShortPiece : public TextPiece {
~ShortPiece();
virtual void read(Reader &reader);
virtual std::string toString();
+ virtual std::string toPlainText();
};
class ViewPiece : public TextPiece {
ViewPiece(Store *view);
virtual void read(Reader &reader);
virtual std::string toString();
+ virtual std::string toPlainText();
};
class StdTextModel : public TextModel {
virtual void internalize(Reader &reader);
virtual std::string toString();
+ virtual std::string toPlainText();
};
} // namespace odc