Permalink
Browse files

const ftw!

  • Loading branch information...
1 parent 9e4d5ef commit bbe4243511075a477ad5f751ef6b0dbd4f16eac2 @nazgob nazgob committed with evanphx Jun 25, 2011
Showing with 29 additions and 29 deletions.
  1. +4 −4 vm/config_parser.cpp
  2. +4 −4 vm/config_parser.hpp
  3. +1 −1 vm/linkedlist.cpp
  4. +1 −1 vm/linkedlist.hpp
  5. +12 −12 vm/util/bert.hpp
  6. +7 −7 vm/util/configuration.hpp
View
@@ -152,19 +152,19 @@ namespace rubinius {
variables[entry->variable] = entry;
}
- bool ConfigParser::Entry::is_number() {
+ bool ConfigParser::Entry::is_number() const {
return rubinius::is_number(value.c_str());
}
- bool ConfigParser::Entry::is_true() {
+ bool ConfigParser::Entry::is_true() const {
return value == "true";
}
- long ConfigParser::Entry::to_i() {
+ long ConfigParser::Entry::to_i() const {
return strtol(value.c_str(), NULL, 10);
}
- bool ConfigParser::Entry::in_section(std::string prefix) {
+ bool ConfigParser::Entry::in_section(std::string prefix) const {
return variable.find(prefix) == 0;
}
View
@@ -16,10 +16,10 @@ namespace rubinius {
std::string variable;
std::string value;
- bool is_number();
- bool is_true();
- bool in_section(std::string prefix);
- long to_i();
+ bool is_number() const;
+ bool is_true() const;
+ bool in_section(std::string prefix) const;
+ long to_i() const;
};
typedef std::map<std::string, Entry*> ConfigMap;
View
@@ -5,7 +5,7 @@
LinkedList::LinkedList() : head_(NULL), count_(0) { }
LinkedList::Node::Node() : next_(NULL), prev_(NULL) { }
-size_t LinkedList::size() {
+size_t LinkedList::size() const {
return count_;
}
View
@@ -57,7 +57,7 @@ class LinkedList {
return head_;
}
- size_t size();
+ size_t size() const;
void add(Node*);
void remove(Node*);
View
@@ -86,15 +86,15 @@ namespace bert {
if(string_) delete[] string_;
}
- TermType type() {
+ TermType type() const {
return type_;
}
- int integer() {
+ int integer() const {
return integer_;
}
- double float_number() {
+ double float_number() const {
return float_;
}
@@ -480,7 +480,7 @@ namespace bert {
, eof_(false)
{}
- bool eof_p() {
+ bool eof_p() const {
return eof_;
}
@@ -593,39 +593,39 @@ namespace bert {
if(sub_value_) delete sub_value_;
}
- Type type() {
+ Type type() const {
return type_;
}
Term* term() {
return term_;
}
- bool integer_p() {
+ bool integer_p() const {
return type_ == Integer;
}
- int integer() {
+ int integer() const {
return term_->integer();
}
- bool float_p() {
+ bool float_p() const {
return type_ == Float;
}
- double float_number() {
+ double float_number() const {
return term_->float_number();
}
- bool string_p() {
+ bool string_p() const {
return type_ == Binary;
}
char* string() {
return term_->string();
}
- bool boolean() {
+ bool boolean() const {
return boolean_;
}
@@ -641,7 +641,7 @@ namespace bert {
time_ = time;
}
- uint64_t time() {
+ uint64_t time() const {
return time_;
}
View
@@ -62,15 +62,15 @@ namespace config {
return true;
}
- const char* name() {
+ const char* name() const {
return name_;
}
- bool set_p() {
+ bool set_p() const {
return set_;
}
- const char* description() {
+ const char* description() const {
return description_;
}
@@ -106,7 +106,7 @@ namespace config {
stream << value;
}
- operator long() {
+ operator long() const {
return value;
}
};
@@ -143,7 +143,7 @@ namespace config {
stream << value;
}
- operator long() {
+ operator long() const {
return value;
}
};
@@ -170,7 +170,7 @@ namespace config {
}
}
- operator const char*() {
+ operator const char*() const {
return value.c_str();
}
};
@@ -203,7 +203,7 @@ namespace config {
stream << (value ? "true" : "false");
}
- operator bool() {
+ operator bool() const {
return value;
}
};

0 comments on commit bbe4243

Please sign in to comment.