~invernizzi/lightspark/readme-update

« back to all changes in this revision

Viewing changes to asobjects.h

  • Committer: Alessandro
  • Date: 2010-04-06 16:24:35 UTC
  • mto: This revision was merged to the branch mainline in revision 577.
  • Revision ID: git-v1:b56d8176917df919e844bd4bd01cb0639c2d9a82
Make use of exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "frame.h"
26
26
#include "input.h"
27
27
#include "compat.h"
 
28
#include "exceptions.h"
28
29
 
29
30
namespace lightspark
30
31
{
414
415
friend class ABCVm;
415
416
protected:
416
417
        std::vector<data_slot> data;
 
418
        void outofbounds() const;
417
419
public:
418
420
        //These utility methods are also used by ByteArray 
419
421
        static bool isValidMultiname(const multiname& name, unsigned int& index);
438
440
        {
439
441
                if(index<data.size())
440
442
                {
441
 
                        if(data[index].data==NULL)
442
 
                                abort();
 
443
                        assert(data[index].data);
443
444
                        return data[index].data;
444
445
                }
445
446
                else
446
 
                        abort();
 
447
                {
 
448
                        outofbounds();
 
449
                        return NULL;
 
450
                }
447
451
        }
448
452
        void set(unsigned int index, ASObject* o)
449
453
        {
450
454
                if(index<data.size())
451
455
                {
452
 
                        if(data[index].data)
453
 
                        {
454
 
                                std::cout << "overwriting" << std::endl;
455
 
                                abort();
456
 
                        }
 
456
                        assert(data[index].data==NULL);
457
457
                        data[index].data=o;
458
458
                        data[index].type=DATA_OBJECT;
459
459
                }
460
460
                else
461
 
                        abort();
 
461
                        outofbounds();
462
462
        }
463
463
        int size() const
464
464
        {
528
528
        UInteger(uint32_t v=0):val(v){type=T_UINTEGER;}
529
529
 
530
530
        static void sinit(Class_base* c);
531
 
        tiny_string toString(bool debugMsg)
532
 
        {
533
 
                abort();
534
 
        }
 
531
        tiny_string toString(bool debugMsg);
535
532
        int32_t toInt() const
536
533
        {
537
534
                return val;
542
539
        }
543
540
        double toNumber() const
544
541
        {
545
 
                abort();
546
 
//              return val;
547
 
        }
548
 
        bool isLess(ASObject* r)
549
 
        {
550
 
                abort();
551
 
        }
 
542
                return val;
 
543
        }
 
544
        bool isLess(ASObject* r);
552
545
        bool isEqual(ASObject* o);
553
546
};
554
547