#include "Ressourcen.h" // Inhalt der RessourceBild Klasse aus Ressource.h // Konstruktor RessourceBild::RessourceBild() : ReferenceCounter() { name = new RCArray< Text >(); bild = new RCArray< Bild >(); anzahl = 0; } // Destruktor RessourceBild::~RessourceBild() { name->release(); bild->release(); } // nicht constant bool RessourceBild::add( Text *name, Bild *bild ) { bool ret = add( name->getText(), bild ); name->release(); return ret; } bool RessourceBild::add( const char *name, Bild *bild ) { if( hat( name ) ) { bild->release(); return 0; } this->name->add( new Text( name ), anzahl ); this->bild->add( bild, anzahl ); anzahl++; return 1; } bool RessourceBild::remove( Text *name ) { bool ret = remove( name->getText() ); name->release(); return ret; } bool RessourceBild::remove( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) { this->name->remove( i ); bild->remove( i ); anzahl--; return 1; } } return 0; } void RessourceBild::reset() { for( int i = 0; i < anzahl; i++ ) { name->remove( 0 ); bild->remove( 0 ); } anzahl = 0; } // constant bool RessourceBild::hat( Text *name ) { bool ret = hat( name->getText() ); name->release(); return ret; } bool RessourceBild::hat( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return 1; } return 0; } Bild *RessourceBild::get( Text *name ) { Bild *ret = get( name->getText() ); name->release(); return ret; } Bild *RessourceBild::get( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return this->bild->get( i ); } return 0; } Bild *RessourceBild::z( Text *name ) { Bild *ret = z( name->getText() ); name->release(); return ret; } Bild *RessourceBild::z( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return this->bild->z( i ); } return 0; } // Inhalt der RessourceSchrift Klasse aus Ressource.h // Konstruktor RessourceSchrift::RessourceSchrift() : ReferenceCounter() { name = new RCArray< Text >(); schrift = new RCArray< Schrift >(); anzahl = 0; } // Destruktor RessourceSchrift::~RessourceSchrift() { name->release(); schrift->release(); } // nicht constant bool RessourceSchrift::add( Text *name, Schrift *schrift ) { bool ret = add( name->getText(), schrift ); name->release(); return ret; } bool RessourceSchrift::add( const char *name, Schrift *schrift ) { if( hat( name ) ) { schrift->release(); return 0; } this->name->add( new Text( name ), anzahl ); this->schrift->add( schrift, anzahl ); anzahl++; return 1; } bool RessourceSchrift::remove( Text *name ) { bool ret = remove( name->getText() ); name->release(); return ret; } bool RessourceSchrift::remove( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) { this->name->remove( i ); schrift->remove( i ); anzahl--; return 1; } } return 0; } void RessourceSchrift::reset() { for( int i = 0; i < anzahl; i++ ) { name->remove( 0 ); schrift->remove( 0 ); } anzahl = 0; } // constant bool RessourceSchrift::hat( Text *name ) { bool ret = hat( name->getText() ); name->release(); return ret; } bool RessourceSchrift::hat( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return 1; } return 0; } Schrift *RessourceSchrift::get( Text *name ) { Schrift *ret = get( name->getText() ); name->release(); return ret; } Schrift *RessourceSchrift::get( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return this->schrift->get( i ); } return 0; } Schrift *RessourceSchrift::z( Text *name ) { Schrift *ret = z( name->getText() ); name->release(); return ret; } Schrift *RessourceSchrift::z( const char *name ) { for( int i = 0; i < anzahl; i++ ) { if( this->name->z( i )->istGleich( name ) ) return this->schrift->z( i ); } return 0; }