Gnash  0.8.11dev
String_as.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 // Implementation for ActionScript String object.
20 
21 #ifndef GNASH_STRING_H
22 #define GNASH_STRING_H
23 
24 #include <string>
25 #include "Relay.h"
26 
27 namespace gnash {
28 
29 class as_object;
30 struct ObjectURI;
31 class Global_as;
32 
33 class String_as : public Relay
34 {
35 
36 public:
37 
38  explicit String_as(std::string s);
39 
40  const std::string& value() {
41  return _string;
42  }
43 
44 private:
45  std::string _string;
46 };
47 
49 void string_class_init(as_object& global, const ObjectURI& uri);
50 
51 void registerStringNative(as_object& global);
52 
53 }
54 
55 #endif // GNASH_STRING_H
gnash::setNaN
void setNaN(as_value &v)
Set a value to NaN.
Definition: as_value.h:524
gnash::key::l
@ l
Definition: GnashKey.h:158
gnash::toInt
std::int32_t toInt(const as_value &v, const VM &vm)
AS2-compatible conversion to 32bit integer.
Definition: VM.cpp:463
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
gnash::key::i
@ i
Definition: GnashKey.h:155
gnash::registerStringNative
void registerStringNative(as_object &global)
Definition: String_as.cpp:83
gnash::utf8::encodeUnicodeCharacter
std::string encodeUnicodeCharacter(std::uint32_t ucs_character)
Encodes the given wide character into a canonical string, theoretically up to 6 chars in length.
Definition: utf8.cpp:165
gnash::NSV::PROP_LENGTH
@ PROP_LENGTH
Definition: namedStrings.h:83
_
#define _(String)
Definition: log.h:44
gnash::utf8::decodeNextUnicodeCharacter
std::uint32_t decodeNextUnicodeCharacter(std::string::const_iterator &it, const std::string::const_iterator &e)
Return the next Unicode character in the UTF-8 encoded string.
Definition: utf8.cpp:93
gnash::as_object::init_member
void init_member(const std::string &name, const as_value &val, int flags=DefaultFlags)
Initialize a member value by string.
Definition: as_object.cpp:669
gnash::VM
The AVM1 virtual machine.
Definition: VM.h:72
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::PropFlags::dontEnum
@ dontEnum
Protect from enumeration.
Definition: PropFlags.h:36
gnash::key::s
@ s
Definition: GnashKey.h:165
as_value.h
NativeFunction.h
start
@ start
Definition: klash_part.cpp:330
Global_as.h
gnash::getGlobal
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
gnash::NSV::PROP_CONSTRUCTOR
@ PROP_CONSTRUCTOR
Definition: namedStrings.h:68
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
gnash::String_as::value
const std::string & value()
Definition: String_as.h:40
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::createObject
as_object * createObject(const Global_as &gl)
Definition: Global_as.cpp:303
gnash::NSV::PROP_PUSH
@ PROP_PUSH
Definition: namedStrings.h:88
gnash::as_object::DefaultFlags
static const int DefaultFlags
The most common flags for built-in properties.
Definition: as_object.h:192
gnash::callMethod
as_value callMethod(fn_call::Args &args, as_object *obj, const ObjectURI &uri)
Call a member function of this object in an AS-compatible way.
Definition: Global_as.h:219
gnash::Relay
This is the base class for type-specific object data.
Definition: Relay.h:50
IF_VERBOSE_ASCODING_ERRORS
#define IF_VERBOSE_ASCODING_ERRORS(x)
Definition: log.h:397
gnash::key::code
code
Definition: GnashKey.h:44
gnash::String_as
Definition: String_as.h:34
length
@ length
Definition: klash_part.cpp:329
gnash::VM::registerNative
void registerNative(as_c_function_ptr fun, unsigned int x, unsigned int y)
Definition: VM.cpp:268
gnash::String_as::String_as
String_as(std::string s)
Definition: String_as.cpp:76
gnash::VM::getNative
NativeFunction * getNative(unsigned int x, unsigned int y) const
Return a native function or null.
Definition: VM.cpp:276
GnashNumeric.h
VM.h
SWFCtype.h
gnash::log_aserror
void log_aserror(StringType msg, Args... args)
Definition: log.h:331
Relay.h
log.h
utf8.h
fn_call.h
gnash::utf8::encodeCanonicalString
std::string encodeCanonicalString(const std::wstring &wstr, int version)
Converts a std::wstring into canonical std::string.
Definition: utf8.cpp:67
gnash::image::end
pixel_iterator< T > end(GnashImage &im)
Definition: ImageIterators.h:198
namedStrings.h
gnash::Global_as
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:50
gnash::getSWFVersion
int getSWFVersion(const as_environment &env)
Definition: as_environment.cpp:657
test.uri
uri
Definition: test.py:12
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::utf8::decodeCanonicalString
std::wstring decodeCanonicalString(const std::string &str, int version)
Converts a std::string with multibyte characters into a std::wstring.
Definition: utf8.cpp:39
movie_definition.h
gnash::key::o
@ o
Definition: GnashKey.h:161
gnash::NSV::PROP_PROTOTYPE
@ PROP_PROTOTYPE
Definition: namedStrings.h:87
gnash::ObjectURI
A URI for describing as_objects.
Definition: ObjectURI.h:45
GnashException.h
gnash::utf8::encodeLatin1Character
std::string encodeLatin1Character(std::uint32_t ucsCharacter)
Encodes the given wide character into an at least 8-bit character.
Definition: utf8.cpp:84
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::string_class_init
void string_class_init(as_object &where, const ObjectURI &uri)
Initialize the global String class.
Definition: String_as.cpp:107
String_as.h