[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10933: Simplify objects for constan
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10933: Simplify objects for constant enumeration and add some constants. |
Date: |
Wed, 27 May 2009 17:35:46 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 10933
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-05-27 17:35:46 +0200
message:
Simplify objects for constant enumeration and add some constants.
modified:
libcore/asobj/flash/display/StageAlign_as.cpp
libcore/asobj/flash/text/TextFieldAutoSize_as.cpp
libcore/asobj/flash/text/TextFieldType_as.cpp
libcore/asobj/flash/text/TextFieldType_as.h
libcore/asobj/flash/text/TextFormatAlign_as.cpp
libcore/asobj/flash/text/TextFormatAlign_as.h
=== modified file 'libcore/asobj/flash/display/StageAlign_as.cpp'
--- a/libcore/asobj/flash/display/StageAlign_as.cpp 2009-05-27 10:28:19
+0000
+++ b/libcore/asobj/flash/display/StageAlign_as.cpp 2009-05-27 15:35:46
+0000
@@ -29,6 +29,8 @@
#include "GnashException.h" // for ActionException
#include "Object.h"
+/// StageAlign is an AVM2-only class
+
namespace gnash {
// Forward declarations
@@ -40,7 +42,9 @@
void
stagealign_class_init(as_object& where)
{
- boost::intrusive_ptr<as_object> obj = new as_object(getObjectInterface());
+ static boost::intrusive_ptr<as_object> obj =
+ new as_object(getObjectInterface());
+
attachStageAlignStaticInterface(*obj);
where.init_member("StageAlign", obj.get());
=== modified file 'libcore/asobj/flash/text/TextFieldAutoSize_as.cpp'
--- a/libcore/asobj/flash/text/TextFieldAutoSize_as.cpp 2009-05-27 15:03:50
+0000
+++ b/libcore/asobj/flash/text/TextFieldAutoSize_as.cpp 2009-05-27 15:35:46
+0000
@@ -22,40 +22,30 @@
#include "as_object.h" // for inheritance
#include "builtin_function.h" // need builtin_function
#include "Object.h"
-
#include "log.h"
-#include <string>
-#include <sstream>
+/// TextFieldAutoSize is an AVM2-only class
namespace gnash {
// Forward declarations
namespace {
void attachTextFieldAutoSizeInterface(as_object& o);
- as_object* getTextFieldAutoSizeInterface();
}
// extern
void
textfieldautosize_class_init(as_object& where)
{
- where.init_member("TextFieldAutoSize", getTextFieldAutoSizeInterface());
+ static boost::intrusive_ptr<as_object> obj =
+ new as_object(getObjectInterface());
+
+ attachTextFieldAutoSizeInterface(*obj);
+ where.init_member("TextFieldAutoSize", obj.get());
}
namespace {
-as_object*
-getTextFieldAutoSizeInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if (!o) {
- o = new as_object(getObjectInterface());
- attachTextFieldAutoSizeInterface(*o);
- }
- return o.get();
-}
-
void
attachTextFieldAutoSizeInterface(as_object& o)
{
=== modified file 'libcore/asobj/flash/text/TextFieldType_as.cpp'
--- a/libcore/asobj/flash/text/TextFieldType_as.cpp 2009-05-24 22:25:59
+0000
+++ b/libcore/asobj/flash/text/TextFieldType_as.cpp 2009-05-27 15:35:46
+0000
@@ -26,63 +26,35 @@
#include "fn_call.h"
#include "smart_ptr.h" // for boost intrusive_ptr
#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
+#include "Object.h"
+
+/// TextFieldType is an AVM2-only class
namespace gnash {
// Forward declarations
namespace {
- as_value textfieldtype_ctor(const fn_call& fn);
- void attachTextFieldTypeInterface(as_object& o);
void attachTextFieldTypeStaticInterface(as_object& o);
- as_object* getTextFieldTypeInterface();
-
}
-// extern (used by Global.cpp)
-void textfieldtype_class_init(as_object& global)
+// extern
+void
+textfieldtype_class_init(as_object& where)
{
- static boost::intrusive_ptr<builtin_function> cl;
-
- if (!cl) {
- cl = new builtin_function(&textfieldtype_ctor,
getTextFieldTypeInterface());
- attachTextFieldTypeStaticInterface(*cl);
- }
-
- // Register _global.TextFieldType
- global.init_member("TextFieldType", cl.get());
+ static boost::intrusive_ptr<as_object> obj =
+ new as_object(getObjectInterface());
+
+ attachTextFieldTypeStaticInterface(*obj);
+ where.init_member("TextFieldType", obj.get());
}
namespace {
void
-attachTextFieldTypeInterface(as_object& o)
-{
-}
-
-void
attachTextFieldTypeStaticInterface(as_object& o)
{
-
-}
-
-as_object*
-getTextFieldTypeInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachTextFieldTypeInterface(*o);
- }
- return o.get();
-}
-
-as_value
-textfieldtype_ctor(const fn_call& fn)
-{
- boost::intrusive_ptr<as_object> obj = new TextFieldType_as;
-
- return as_value(obj.get()); // will keep alive
+ o.init_member("DYNAMIC", "dynamic");
+ o.init_member("INPUT", "input");
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/text/TextFieldType_as.h'
--- a/libcore/asobj/flash/text/TextFieldType_as.h 2009-05-24 22:25:59
+0000
+++ b/libcore/asobj/flash/text/TextFieldType_as.h 2009-05-27 15:35:46
+0000
@@ -28,24 +28,6 @@
namespace gnash {
-// Forward declarations
-class as_object;
-namespace {
- as_object* getTextFieldTypeInterface();
-}
-
-class TextFieldType_as: public as_object
-{
-
-public:
-
- TextFieldType_as()
- :
- as_object(getTextFieldTypeInterface())
- {}
-
-};
-
/// Initialize the global TextFieldType class
void textfieldtype_class_init(as_object& global);
=== modified file 'libcore/asobj/flash/text/TextFormatAlign_as.cpp'
--- a/libcore/asobj/flash/text/TextFormatAlign_as.cpp 2009-05-24 22:25:59
+0000
+++ b/libcore/asobj/flash/text/TextFormatAlign_as.cpp 2009-05-27 15:35:46
+0000
@@ -26,63 +26,38 @@
#include "fn_call.h"
#include "smart_ptr.h" // for boost intrusive_ptr
#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
+#include "Object.h"
+
+/// TextFormatAlign is an AVM2-only class containing constants.
namespace gnash {
// Forward declarations
namespace {
- as_value textformatalign_ctor(const fn_call& fn);
- void attachTextFormatAlignInterface(as_object& o);
void attachTextFormatAlignStaticInterface(as_object& o);
- as_object* getTextFormatAlignInterface();
-
}
// extern (used by Global.cpp)
void textformatalign_class_init(as_object& global)
{
- static boost::intrusive_ptr<builtin_function> cl;
+ static boost::intrusive_ptr<as_object> obj =
+ new as_object(getObjectInterface());
- if (!cl) {
- cl = new builtin_function(&textformatalign_ctor,
getTextFormatAlignInterface());
- attachTextFormatAlignStaticInterface(*cl);
- }
+ attachTextFormatAlignStaticInterface(*obj);
// Register _global.TextFormatAlign
- global.init_member("TextFormatAlign", cl.get());
+ global.init_member("TextFormatAlign", obj.get());
}
namespace {
void
-attachTextFormatAlignInterface(as_object& o)
-{
-}
-
-void
attachTextFormatAlignStaticInterface(as_object& o)
{
-
-}
-
-as_object*
-getTextFormatAlignInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachTextFormatAlignInterface(*o);
- }
- return o.get();
-}
-
-as_value
-textformatalign_ctor(const fn_call& fn)
-{
- boost::intrusive_ptr<as_object> obj = new TextFormatAlign_as;
-
- return as_value(obj.get()); // will keep alive
+ o.init_member("CENTER", "center");
+ o.init_member("JUSTIFY", "justify");
+ o.init_member("LEFT", "left");
+ o.init_member("RIGHT", "right");
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/text/TextFormatAlign_as.h'
--- a/libcore/asobj/flash/text/TextFormatAlign_as.h 2009-05-24 22:25:59
+0000
+++ b/libcore/asobj/flash/text/TextFormatAlign_as.h 2009-05-27 15:35:46
+0000
@@ -28,30 +28,11 @@
namespace gnash {
-// Forward declarations
-class as_object;
-namespace {
- as_object* getTextFormatAlignInterface();
-}
-
-class TextFormatAlign_as: public as_object
-{
-
-public:
-
- TextFormatAlign_as()
- :
- as_object(getTextFormatAlignInterface())
- {}
-
-};
-
/// Initialize the global TextFormatAlign class
void textformatalign_class_init(as_object& global);
} // gnash namespace
-// GNASH_ASOBJ3_TEXTFORMATALIGN_H
#endif
// local Variables:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10933: Simplify objects for constant enumeration and add some constants.,
Benjamin Wolsey <=