[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server array.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash/server array.cpp |
Date: |
Thu, 06 Jul 2006 07:59:50 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/07/06 07:59:50
Modified files:
server : array.cpp
Log message:
indentation
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.27&r2=1.28
Patches:
Index: array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- array.cpp 5 Jul 2006 17:10:39 -0000 1.27
+++ array.cpp 6 Jul 2006 07:59:50 -0000 1.28
@@ -63,24 +63,24 @@
// @@ TODO : implement as_array_object's unimplemented functions
- as_array_object::as_array_object()
+as_array_object::as_array_object()
:
as_object(getArrayInterface()), // pass Array inheritance
elements(0)
- {
+{
log_action("%s : %p\n", __FUNCTION__, (void*)this);
- }
+}
- as_array_object::as_array_object(const as_array_object& other)
+as_array_object::as_array_object(const as_array_object& other)
:
as_object(other),
elements(other.elements)
- {
+{
log_action("%s : %p\n", __FUNCTION__, (void*)this);
- }
+}
- int as_array_object::index_requested(const tu_stringi& name)
- {
+int as_array_object::index_requested(const tu_stringi& name)
+{
double value;
as_value temp;
temp.set_string(name.c_str());
@@ -89,24 +89,26 @@
// if we were sent a string that can't convert like "asdf", it
returns as NaN. -1 means invalid index
if (isnan(value)) return -1;
- // TODO / WARNING: because to_number returns a double and we're
converting to an int,
+ // TODO / WARNING: because to_number returns a double and we're
+ // converting to an int,
// I want to make sure we're above any "grey area" when we we
round down
- // by adding a little to the number before we round it. We
don't want to accidentally look to index-1!
+ // by adding a little to the number before we round it.
+ // We don't want to accidentally look to index-1!
return int(value + 0.01);
- }
+}
- void as_array_object::push(as_value& val)
- {
+void as_array_object::push(as_value& val)
+{
elements.push_back(val);
- }
+}
- void as_array_object::unshift(as_value& val)
- {
+void as_array_object::unshift(as_value& val)
+{
elements.push_front(val);
- }
+}
- as_value as_array_object::pop()
- {
+as_value as_array_object::pop()
+{
// If the array is empty, report an error and return undefined!
if (elements.size() <= 0)
{
@@ -118,10 +120,10 @@
elements.pop_back();
return ret;
- }
+}
- as_value as_array_object::shift()
- {
+as_value as_array_object::shift()
+{
// If the array is empty, report an error and return undefined!
if (elements.size() <= 0)
{
@@ -133,16 +135,16 @@
elements.pop_front();
return ret;
- }
+}
- void as_array_object::reverse()
- {
+void as_array_object::reverse()
+{
// Reverse the deque elements
std::reverse(elements.begin(), elements.end());
- }
+}
- std::string as_array_object::join(const std::string& separator)
- {
+std::string as_array_object::join(const std::string& separator)
+{
// TODO - confirm this is the right format!
// Reportedly, flash version 7 on linux, and Flash 8 on IE look
like
// "(1,2,3)" and "1,2,3" respectively - which should we mimic?
@@ -173,33 +175,33 @@
return temp;
- }
+}
- void as_array_object::concat(const as_array_object& other)
- {
+void as_array_object::concat(const as_array_object& other)
+{
elements.insert(elements.end(), other.elements.begin(),
other.elements.end());
- }
+}
- std::string as_array_object::toString()
- {
+std::string as_array_object::toString()
+{
return join(",");
- }
+}
- unsigned int as_array_object::size() const
- {
+unsigned int as_array_object::size() const
+{
return elements.size();
- }
+}
#if 0
- void as_array_object::resize(unsigned int newsize)
- {
+void as_array_object::resize(unsigned int newsize)
+{
elements.resize(newsize);
- }
+}
#endif
- as_value as_array_object::at(unsigned int index)
- {
+as_value as_array_object::at(unsigned int index)
+{
if ( index > elements.size()-1 )
{
return as_value();
@@ -208,11 +210,11 @@
{
return elements[index];
}
- }
+}
- std::auto_ptr<as_array_object>
- as_array_object::slice(unsigned int start, unsigned int one_past_end)
- {
+std::auto_ptr<as_array_object>
+as_array_object::slice(unsigned int start, unsigned int one_past_end)
+{
std::auto_ptr<as_array_object> newarray(new as_array_object);
newarray->elements.resize(one_past_end - start - 1);
@@ -224,12 +226,12 @@
return newarray;
- }
+}
- /* virtual public, overriding as_object::set_member */
- bool as_array_object::get_member(const tu_stringi& name, as_value *val)
- {
+/* virtual public, overriding as_object::set_member */
+bool as_array_object::get_member(const tu_stringi& name, as_value *val)
+{
if ( name == "length" )
{
val->set_double((double)size());
@@ -245,12 +247,12 @@
}
return get_member_default(name, val);
- }
+}
- /* virtual public, overriding as_object::set_member */
- void as_array_object::set_member(const tu_stringi& name,
+/* virtual public, overriding as_object::set_member */
+void as_array_object::set_member(const tu_stringi& name,
const as_value& val )
- {
+{
if ( name == "length" )
{
log_action("assigning to Array.length unsupported");
@@ -275,21 +277,21 @@
}
as_object::set_member_default(name,val);
- }
+}
- // Callback for unimplemented functions
- void array_not_impl(const fn_call& fn)
- {
+// Callback for unimplemented functions
+void array_not_impl(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
//as_array_object* array =
static_cast<as_array_object*>(fn.this_ptr);
log_action("ERROR: array method not implemented yet!\n");
- }
+}
- // Callback to report array length
- void array_length(const fn_call& fn)
- {
+// Callback to report array length
+void array_length(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -297,11 +299,11 @@
log_action("calling array length, result:%d\n",array->size());
fn.result->set_int(array->size());
- }
+}
- // Callback to push values to the back of an array
- void array_push(const fn_call& fn)
- {
+// Callback to push values to the back of an array
+void array_push(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -312,11 +314,11 @@
array->push(fn.arg(i));
fn.result->set_int(array->size());
- }
+}
- // Callback to push values to the front of an array
- void array_unshift(const fn_call& fn)
- {
+// Callback to push values to the front of an array
+void array_unshift(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -327,11 +329,11 @@
array->unshift(fn.arg(i));
fn.result->set_int(array->size());
- }
+}
- // Callback to pop a value from the back of an array
- void array_pop(const fn_call& fn)
- {
+// Callback to pop a value from the back of an array
+void array_pop(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -339,11 +341,11 @@
// Get our index, log, then return result
(*fn.result) = array->pop();
log_action("calling array pop, result:%s, new array
size:%zd\n",fn.result->to_string(),array->size());
- }
+}
- // Callback to pop a value from the front of an array
- void array_shift(const fn_call& fn)
- {
+// Callback to pop a value from the front of an array
+void array_shift(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -351,11 +353,11 @@
// Get our index, log, then return result
(*fn.result) = array->shift();
log_action("calling array shift, result:%s, new array
size:%zd\n",fn.result->to_string(),array->size());
- }
+}
- // Callback to reverse the position of the elements in an array
- void array_reverse(const fn_call& fn)
- {
+// Callback to reverse the position of the elements in an array
+void array_reverse(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -366,11 +368,11 @@
log_action("called array reverse, result:%s, new array
size:%zd\n",fn.result->to_string(),array->size());
- }
+}
- // Callback to convert array to a string with optional custom separator
(default ',')
- void array_join(const fn_call& fn)
- {
+// Callback to convert array to a string with optional custom separator
(default ',')
+void array_join(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -383,11 +385,11 @@
std::string ret = array->join(separator);
fn.result->set_string(ret.c_str());
- }
+}
- // Callback to convert array to a string
- void array_to_string(const fn_call& fn)
- {
+// Callback to convert array to a string
+void array_to_string(const fn_call& fn)
+{
log_action("array_to_string called, nargs = %d, "
"this_ptr = %p",
fn.nargs, (void*)fn.this_ptr);
@@ -401,15 +403,15 @@
log_action("to_string result is: %s", ret.c_str());
fn.result->set_string(ret.c_str());
- }
+}
- /// concatenates the elements specified in the parameters with
- /// the elements in my_array, and creates a new array. If the
- /// value parameters specify an array, the elements of that
- /// array are concatenated, rather than the array itself. The
- /// array my_array is left unchanged.
- void array_concat(const fn_call& fn)
- {
+/// concatenates the elements specified in the parameters with
+/// the elements in my_array, and creates a new array. If the
+/// value parameters specify an array, the elements of that
+/// array are concatenated, rather than the array itself. The
+/// array my_array is left unchanged.
+void array_concat(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -432,12 +434,12 @@
}
fn.result->set_as_object(newarray);
- }
+}
- // Callback to slice part of an array to a new array
- // without changing the original
- void array_slice(const fn_call& fn)
- {
+// Callback to slice part of an array to a new array
+// without changing the original
+void array_slice(const fn_call& fn)
+{
assert(dynamic_cast<as_array_object*>(fn.this_ptr));
as_array_object* array = \
static_cast<as_array_object*>(fn.this_ptr);
@@ -504,10 +506,10 @@
fn.result->set_as_object(newarray.release());
- }
+}
- void array_new(const fn_call& fn)
- {
+void array_new(const fn_call& fn)
+{
log_action("array_new called, nargs = %d", fn.nargs);
//smart_ptr<as_array_object> ao = new as_array_object;
@@ -545,7 +547,7 @@
//fn.result->set_as_object(ao.get_ptr());
fn.result->set_as_object(ao);
- }
+}
static void
attachArrayInterface(as_object* proto)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/server array.cpp,
Sandro Santilli <=