Skip to content

Commit

Permalink
const ftw!
Browse files Browse the repository at this point in the history
  • Loading branch information
nazgob authored and evanphx committed Jun 25, 2011
1 parent 9e4d5ef commit bbe4243
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions vm/config_parser.cpp
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions vm/config_parser.hpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion vm/linkedlist.cpp
Expand Up @@ -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_;
}

Expand Down
2 changes: 1 addition & 1 deletion vm/linkedlist.hpp
Expand Up @@ -57,7 +57,7 @@ class LinkedList {
return head_;
}

size_t size();
size_t size() const;
void add(Node*);
void remove(Node*);

Expand Down
24 changes: 12 additions & 12 deletions vm/util/bert.hpp
Expand Up @@ -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_;
}

Expand Down Expand Up @@ -480,7 +480,7 @@ namespace bert {
, eof_(false)
{}

bool eof_p() {
bool eof_p() const {
return eof_;
}

Expand Down Expand Up @@ -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_;
}

Expand All @@ -641,7 +641,7 @@ namespace bert {
time_ = time;
}

uint64_t time() {
uint64_t time() const {
return time_;
}

Expand Down
14 changes: 7 additions & 7 deletions vm/util/configuration.hpp
Expand Up @@ -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_;
}

Expand Down Expand Up @@ -106,7 +106,7 @@ namespace config {
stream << value;
}

operator long() {
operator long() const {
return value;
}
};
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace config {
stream << value;
}

operator long() {
operator long() const {
return value;
}
};
Expand All @@ -170,7 +170,7 @@ namespace config {
}
}

operator const char*() {
operator const char*() const {
return value.c_str();
}
};
Expand Down Expand Up @@ -203,7 +203,7 @@ namespace config {
stream << (value ? "true" : "false");
}

operator bool() {
operator bool() const {
return value;
}
};
Expand Down

0 comments on commit bbe4243

Please sign in to comment.