Const Correctness for String::Value

Patch by Patrick Gansterer <paroga@paroga.com>.
Review at http://codereview.chromium.org/199043.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ab54e953
...@@ -17,3 +17,4 @@ Paolo Giarrusso <p.giarrusso@gmail.com> ...@@ -17,3 +17,4 @@ Paolo Giarrusso <p.giarrusso@gmail.com>
Rafal Krypa <rafal@krypa.net> Rafal Krypa <rafal@krypa.net>
Rene Rebe <rene@exactcode.de> Rene Rebe <rene@exactcode.de>
Ryan Dahl <coldredlemur@gmail.com> Ryan Dahl <coldredlemur@gmail.com>
Patrick Gansterer <paroga@paroga.com>
...@@ -979,8 +979,9 @@ class V8EXPORT String : public Primitive { ...@@ -979,8 +979,9 @@ class V8EXPORT String : public Primitive {
public: public:
explicit Utf8Value(Handle<v8::Value> obj); explicit Utf8Value(Handle<v8::Value> obj);
~Utf8Value(); ~Utf8Value();
char* operator*() const { return str_; } char* operator*() { return str_; }
int length() { return length_; } const char* operator*() const { return str_; }
int length() const { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
...@@ -1001,8 +1002,9 @@ class V8EXPORT String : public Primitive { ...@@ -1001,8 +1002,9 @@ class V8EXPORT String : public Primitive {
public: public:
explicit AsciiValue(Handle<v8::Value> obj); explicit AsciiValue(Handle<v8::Value> obj);
~AsciiValue(); ~AsciiValue();
char* operator*() const { return str_; } char* operator*() { return str_; }
int length() { return length_; } const char* operator*() const { return str_; }
int length() const { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
...@@ -1023,7 +1025,8 @@ class V8EXPORT String : public Primitive { ...@@ -1023,7 +1025,8 @@ class V8EXPORT String : public Primitive {
explicit Value(Handle<v8::Value> obj); explicit Value(Handle<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() const { return str_; } uint16_t* operator*() const { return str_; }
int length() { return length_; } const uint16_t* operator*() { return str_; }
int length() const { return length_; }
private: private:
uint16_t* str_; uint16_t* str_;
int length_; int length_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment