summaryrefslogtreecommitdiff
path: root/src/user/lib/fwik/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/fwik/include')
-rw-r--r--src/user/lib/fwik/include/IO/IOStream.h10
-rw-r--r--src/user/lib/fwik/include/IO/Node.h6
-rw-r--r--src/user/lib/fwik/include/IO/Term.h8
-rw-r--r--src/user/lib/fwik/include/String.h24
4 files changed, 29 insertions, 19 deletions
diff --git a/src/user/lib/fwik/include/IO/IOStream.h b/src/user/lib/fwik/include/IO/IOStream.h
index e381cf5..2e33268 100644
--- a/src/user/lib/fwik/include/IO/IOStream.h
+++ b/src/user/lib/fwik/include/IO/IOStream.h
@@ -12,14 +12,18 @@ class IOStream {
IOStream() : term(0) {}
IOStream(Term *t) : term(t) {}
- void print(char* str);
- void printf(char* fmt, ...);
+ void print(const char* str);
+ void printf(const char* fmt, ...);
String readln();
- IOStream &operator<<(char* s) {
+ IOStream &operator<<(const char* s) {
print(s);
return *this;
}
+ IOStream &operator<<(const String& s) {
+ print(s.c_str());
+ return *this;
+ }
IOStream &operator<<(int i) {
printf("%d", i);
return *this;
diff --git a/src/user/lib/fwik/include/IO/Node.h b/src/user/lib/fwik/include/IO/Node.h
index 6100fc9..ed8290f 100644
--- a/src/user/lib/fwik/include/IO/Node.h
+++ b/src/user/lib/fwik/include/IO/Node.h
@@ -6,6 +6,8 @@
#include <stdio.h>
#include <cpp.h>
+#include <String.h>
+
class Term;
class Node {
public:
@@ -14,7 +16,7 @@ class Node {
bool valid;
Node(FILE f);
- Node(char* filename, int mode);
+ Node(const char* filename, int mode);
virtual ~Node() {}
void close();
@@ -22,4 +24,6 @@ class Node {
virtual Term* as_term() { return 0; }
};
+String path_cat(const String &a, const String &b, bool trailing_slash = true);
+
#endif
diff --git a/src/user/lib/fwik/include/IO/Term.h b/src/user/lib/fwik/include/IO/Term.h
index 4fd9306..5b8aba3 100644
--- a/src/user/lib/fwik/include/IO/Term.h
+++ b/src/user/lib/fwik/include/IO/Term.h
@@ -16,13 +16,13 @@ class Term : public Node {
public:
Term(FILE f);
- Term(char* filename, int mode);
+ Term(const char* filename, int mode);
Term(const Node &n);
virtual ~Term();
- virtual void print(char *s);
- virtual void printf(char* fmt, ...);
- virtual void vprintf(char* fmt, va_list ap);
+ virtual void print(const char *s);
+ virtual void printf(const char* fmt, ...);
+ virtual void vprintf(const char* fmt, va_list ap);
virtual String readln();
String readline();
diff --git a/src/user/lib/fwik/include/String.h b/src/user/lib/fwik/include/String.h
index 672220d..59fa0b6 100644
--- a/src/user/lib/fwik/include/String.h
+++ b/src/user/lib/fwik/include/String.h
@@ -11,30 +11,32 @@ class String {
public:
String();
String(const String& other);
- String(char* ptr);
- String(char* ptr, int len);
+ String(const char* ptr);
+ String(const char* ptr, int len);
String(char c, int count);
~String();
void operator=(const String &string);
- void operator=(char* ptr);
+ void operator=(const char* ptr);
- char* c_str();
+ const char* c_str() const;
- bool operator==(const String& other);
- bool operator==(char* other);
- bool operator<(const String& other);
+ bool operator==(const String& other) const;
+ bool operator==(const char* other) const;
+ bool operator<(const String& other) const;
char &operator[](int pos);
+ char operator[](int pos) const;
- int size() { return len; }
- operator bool() { return len != 0; }
- String substr(int start, int count);
+ int size() const { return len; }
+ operator bool() const { return len != 0; }
+ String substr(int start, int count) const;
- String operator+(const String& other);
+ String operator+(const String& other) const;
void operator+=(const String& other);
void operator+=(char c);
static String dec(int i);
static String hex(uint32_t v);
+ static String sprintf(const char* format, ...);
};
#endif