Pepper_47_C++_interfaces
|
A generic type used for passing data types between the module and the page. More...
#include <var.h>
Classes | |
struct | DontManage |
struct | Null |
Special value passed to constructor to make NULL . More... | |
class | OutException |
Public Member Functions | |
Var () | |
Var (Null) | |
A constructor used to create a Var of type Null . More... | |
Var (bool b) | |
Var (int32_t i) | |
Var (double d) | |
Var (const char *utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const std::string &utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const pp::Resource &resource) | |
A constructor used to create a resource Var . More... | |
Var (PassRef, const PP_Var &var) | |
Var (const PP_Var &var) | |
A constructor that increments the reference count. More... | |
Var (DontManage, const PP_Var &var) | |
Var (const Var &other) | |
A constructor for copying a Var . More... | |
virtual | ~Var () |
Destructor. More... | |
virtual Var & | operator= (const Var &other) |
bool | operator== (const Var &other) const |
bool | is_undefined () const |
bool | is_null () const |
bool | is_bool () const |
bool | is_string () const |
bool | is_object () const |
bool | is_array () const |
bool | is_dictionary () const |
bool | is_resource () const |
bool | is_int () const |
bool | is_double () const |
bool | is_number () const |
bool | is_array_buffer () const |
This function determines if this Var is an ArrayBuffer. More... | |
bool | AsBool () const |
int32_t | AsInt () const |
double | AsDouble () const |
std::string | AsString () const |
pp::Resource | AsResource () const |
const PP_Var & | pp_var () const |
PP_Var | Detach () |
std::string | DebugString () const |
Protected Attributes | |
PP_Var | var_ |
bool | is_managed_ |
A generic type used for passing data types between the module and the page.
pp::Var::Var | ( | ) |
Default constructor. Creates a Var
of type Undefined
.
Definition at line 94 of file var.cc.
References is_managed_, and var_.
Referenced by pp::VarArray::Get(), pp::VarDictionary::Get(), pp::VarArray::operator=(), pp::VarDictionary::operator=(), pp::VarArray::VarArray(), pp::VarDictionary::VarDictionary(), pp::VarPrivate::OutException::~OutException(), and pp::Var::OutException::~OutException().
pp::Var::Var | ( | Null | ) |
pp::Var::Var | ( | bool | b | ) |
A constructor used to create a Var
of type Bool
.
[in] | b | A boolean value. |
Definition at line 106 of file var.cc.
References is_managed_, and var_.
pp::Var::Var | ( | int32_t | i | ) |
A constructor used to create a 32 bit integer Var
.
[in] | i | A 32 bit integer value. |
Definition at line 113 of file var.cc.
References is_managed_, and var_.
pp::Var::Var | ( | double | d | ) |
A constructor used to create a double value Var
.
[in] | d | A double value. |
Definition at line 120 of file var.cc.
References is_managed_, and var_.
pp::Var::Var | ( | const char * | utf8_str | ) |
A constructor used to create a UTF-8 character Var
.
Definition at line 127 of file var.cc.
References is_managed_, and var_.
pp::Var::Var | ( | const std::string & | utf8_str | ) |
A constructor used to create a UTF-8 character Var
.
Definition at line 133 of file var.cc.
References is_managed_, and var_.
|
explicit |
A constructor used to create a resource Var
.
Definition at line 139 of file var.cc.
References is_managed_, PP_NOTREACHED, pp::Resource::pp_resource(), and var_.
A constructor used when you have received a Var
as a return value that has had its reference count incremented for you.
You will not normally need to use this constructor because the reference count will not normally be incremented for you.
Definition at line 62 of file var.h.
References is_managed_, and var_.
|
explicit |
A constructor that increments the reference count.
Definition at line 153 of file var.cc.
References is_managed_, and var_.
|
inline |
This constructor is used when we've given a PP_Var
as an input argument from somewhere and that reference is managing the reference count for us. The object will not have its reference count increased or decreased by this class instance.
[in] | var | A Var . |
Definition at line 78 of file var.h.
References is_managed_, and var_.
pp::Var::Var | ( | const Var & | other | ) |
A constructor for copying a Var
.
Definition at line 162 of file var.cc.
References is_managed_, and var_.
|
virtual |
bool pp::Var::AsBool | ( | ) | const |
AsBool() converts this Var
to a bool. Assumes the internal representation is_bool(). If it's not, it will assert in debug mode, and return false.
Var
. Definition at line 224 of file var.cc.
References is_bool(), PP_NOTREACHED, and var_.
Referenced by DebugString(), operator==(), pp::ext::internal::FromVarConverter< bool >::Set(), pp::ExtensionSystemSamsungTizen::SetIMERecommendedWords(), and pp::ExtensionSystemSamsungTizen::SetIMERecommendedWordsType().
double pp::Var::AsDouble | ( | ) | const |
AsDouble() converts this Var
to a double. This function is necessary because JavaScript doesn't have a concept of ints and doubles, only numbers. The distinction between the two is an optimization inside the compiler. Since converting from a double to an int may be lossy, if you care about the distinction, either always work in doubles, or check !is_double() before calling AsInt().
These functions will assert in debug mode and return 0 if the internal representation is not is_number().
Var
. Definition at line 241 of file var.cc.
References is_double(), is_int(), PP_NOTREACHED, and var_.
Referenced by DebugString(), operator==(), and pp::ext::internal::FromVarConverter< double >::Set().
int32_t pp::Var::AsInt | ( | ) | const |
AsInt() converts this Var
to an int32_t. This function is required because JavaScript doesn't have a concept of ints and doubles, only numbers. The distinction between the two is an optimization inside the compiler. Since converting from a double to an int may be lossy, if you care about the distinction, either always work in doubles, or check !is_double() before calling AsInt().
These functions will assert in debug mode and return 0 if the internal representation is not is_number().
Var
. Definition at line 232 of file var.cc.
References is_double(), is_int(), PP_NOTREACHED, and var_.
Referenced by DebugString(), pp::URLResponseInfo::GetStatusCode(), pp::ExtensionSystemSamsungTizen::GetWindowId(), operator==(), and pp::ext::internal::FromVarConverter< int32_t >::Set().
pp::Resource pp::Var::AsResource | ( | ) | const |
Gets the resource contained in the var. If this object is not a resource, it will assert in debug mode, and return a null resource.
pp::Resource
that is contained in the var. Definition at line 269 of file var.cc.
References is_resource(), pp::PASS_REF, PP_NOTREACHED, and var_.
std::string pp::Var::AsString | ( | ) | const |
AsString() converts this Var
to a string. If this object is not a string, it will assert in debug mode, and return an empty string.
Var
. Definition at line 250 of file var.cc.
References is_string(), PP_NOTREACHED, and var_.
Referenced by pp::ExtensionSystemSamsungTizen::CheckPrivilege(), DebugString(), pp::NetAddressPrivate::Describe(), pp::NetworkList::GetDisplayName(), pp::ExtensionSystemSamsung::GetEmbedderName(), pp::NetworkList::GetName(), operator==(), and pp::ext::internal::FromVarConverter< std::string >::Set().
std::string pp::Var::DebugString | ( | ) | const |
DebugString() returns a short description "Var<X>" that can be used for logging, where "X" is the underlying scalar or "UNDEFINED" or "OBJ" as it does not call into the browser to get the object description.
Var
. This function is used for debugging. Definition at line 283 of file var.cc.
References AsBool(), AsDouble(), AsInt(), AsString(), is_array(), is_array_buffer(), is_bool(), is_dictionary(), is_double(), is_int(), is_null(), is_object(), is_resource(), is_string(), and is_undefined().
|
inline |
Detach() detaches from the internal PP_Var
of this object, keeping the reference count the same. This is used when returning a PP_Var
from an API function where the caller expects the return value to have the reference count incremented for it.
Definition at line 237 of file var.h.
References is_managed_, and var_.
|
inline |
This function determines if this Var
is an array.
Var
is an array, otherwise false. Definition at line 133 of file var.h.
References var_.
Referenced by DebugString(), pp::VarDictionary::GetKeys(), pp::VarArray::operator=(), and pp::VarArray::VarArray().
|
inline |
This function determines if this Var
is an ArrayBuffer.
Definition at line 175 of file var.h.
References var_.
Referenced by pp::VarArrayBuffer::ByteLength(), DebugString(), pp::VarArrayBuffer::Map(), pp::VarArrayBuffer::operator=(), pp::VarArrayBuffer::Unmap(), and pp::VarArrayBuffer::VarArrayBuffer().
|
inline |
This function determines if this Var
is a bool value.
Var
is a bool, otherwise false. Definition at line 118 of file var.h.
References var_.
Referenced by AsBool(), DebugString(), pp::ExtensionSystemSamsungTizen::SetIMERecommendedWords(), and pp::ExtensionSystemSamsungTizen::SetIMERecommendedWordsType().
|
inline |
This function determines if this Var
is a dictionary.
Var
is a dictionary, otherwise false. Definition at line 138 of file var.h.
References var_.
Referenced by DebugString(), pp::VarDictionary::operator=(), and pp::VarDictionary::VarDictionary().
|
inline |
This function determines if this Var
is a double value. The is_double
function returns the internal representation. The JavaScript runtime may convert between the two as needed, so the distinction may not be relevant in all cases (int is really an optimization inside the runtime). So most of the time, you will want to check is_number().
Var
is a double, otherwise false. Definition at line 163 of file var.h.
References var_.
Referenced by AsDouble(), AsInt(), and DebugString().
|
inline |
This function determines if this Var
is an integer value. The is_int
function returns the internal representation. The JavaScript runtime may convert between the two as needed, so the distinction may not be relevant in all cases (int is really an optimization inside the runtime). So most of the time, you will want to check is_number().
Var
is an integer, otherwise false. Definition at line 153 of file var.h.
References var_.
Referenced by AsDouble(), AsInt(), and DebugString().
|
inline |
|
inline |
|
inline |
|
inline |
This function determines if this Var
is a resource.
Var
is a resource, otherwise false. Definition at line 143 of file var.h.
References var_.
Referenced by AsResource(), and DebugString().
|
inline |
This function determines if this Var
is a string value.
Var
is a string, otherwise false. Definition at line 123 of file var.h.
References var_.
Referenced by AsString(), pp::ExtensionSystemSamsungTizen::CheckPrivilege(), DebugString(), pp::NetAddressPrivate::Describe(), pp::NetworkList::GetDisplayName(), pp::ExtensionSystemSamsung::GetEmbedderName(), and pp::NetworkList::GetName().
|
inline |
This function assigns one Var
to another Var
.
[in] | other | The Var to be assigned. |
Var
. Reimplemented in pp::VarArrayBuffer, pp::VarDictionary, and pp::VarArray.
Definition at line 176 of file var.cc.
References is_managed_, and var_.
Referenced by pp::VarArray::operator=(), pp::VarDictionary::operator=(), pp::VarArrayBuffer::operator=(), pp::VarArray::VarArray(), and pp::VarDictionary::VarDictionary().
This function compares object identity (rather than value identity) for objects, dictionaries, and arrays
Definition at line 197 of file var.cc.
References AsBool(), AsDouble(), AsInt(), AsString(), and var_.
|
inline |
This function returns the internal PP_Var
managed by this Var
object.
PP_Var
. Definition at line 226 of file var.h.
References var_.
Referenced by pp::VarPrivate::Call(), pp::URLUtil_Dev::Canonicalize(), pp::WebSocket::Close(), pp::WebSocket::Connect(), pp::VarPrivate::Construct(), pp::VarDictionary::Delete(), pp::URLUtil_Dev::DocumentCanRequest(), pp::InstancePrivate::ExecuteScript(), pp::ExtensionSystemSamsung::GenericSyncCall(), pp::VarDictionary::Get(), pp::VarPrivate::GetProperty(), pp::NetworkProxy::GetProxyForURL(), pp::VarDictionary::HasKey(), pp::VarPrivate::HasMethod(), pp::VarPrivate::HasProperty(), pp::IMEInputEvent::IMEInputEvent(), pp::URLUtil_Dev::IsSameSecurityOrigin(), pp::KeyboardInputEvent::KeyboardInputEvent(), pp::Instance::LogToConsole(), pp::Instance::LogToConsoleWithSource(), pp::VarPrivate::OutException::OutException(), pp::ext::internal::ArrayVarOutputAdapterWithStorage< T >::output(), pp::Instance::PostMessage(), pp::ext::internal::ToVarConverterBase::pp_var(), pp::WebSocket::ReceiveMessage(), pp::VarPrivate::RemoveProperty(), pp::URLUtil_Dev::ResolveRelativeToDocument(), pp::URLUtil_Dev::ResolveRelativeToURL(), pp::WebSocket::SendMessage(), pp::VarArray::Set(), pp::VarDictionary::Set(), pp::TCPSocketPrivate::SetOption(), pp::UDPSocket::SetOption(), pp::TCPSocket::SetOption(), pp::URLRequestInfo::SetProperty(), pp::VarPrivate::SetProperty(), pp::UDPSocketPrivate::SetSocketFeature(), pp::URLDataSource_Samsung::SetStreamingProperty(), and pp::TextInputController::UpdateSurroundingText().
|
protected |
|
protected |
Definition at line 308 of file var.h.
Referenced by AsBool(), AsDouble(), AsInt(), AsResource(), AsString(), pp::VarArrayBuffer::ByteLength(), pp::VarDictionary::Delete(), Detach(), pp::VarArray::Get(), pp::VarDictionary::Get(), pp::VarDictionary::GetKeys(), pp::VarArray::GetLength(), pp::VarDictionary::HasKey(), is_array(), is_array_buffer(), is_bool(), is_dictionary(), is_double(), is_int(), is_null(), is_number(), is_object(), is_resource(), is_string(), is_undefined(), pp::VarArrayBuffer::Map(), operator=(), operator==(), pp::Var::OutException::OutException(), pp_var(), pp::VarArray::Set(), pp::VarDictionary::Set(), pp::VarArray::SetLength(), pp::VarArrayBuffer::Unmap(), Var(), pp::VarArray::VarArray(), pp::VarArrayBuffer::VarArrayBuffer(), pp::VarDictionary::VarDictionary(), and ~Var().