Jump to content
  • Advertisement

VoidSpirit

Member
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

130 Neutral

About VoidSpirit

  • Rank
    Member

Personal Information

  • Interests
    |programmer|
  1. VoidSpirit

    Assigning property without a setter

    to Sir Ementaler Thank you for detailed answer. In my task property is nested object, and immediate changing property value is not needed, only assign some value to this nested object using it's overloaded assigning methods. I.e. there are legal semantics:   foo.name.opAssign("TEST") // used getter for 'name' and overloaded assign and   foo.get_name()="TEST" // getter for 'name' used directly, overloaded assign used implicitly but not   foo.name="TEST" // expected implicit using getter and overloaded assign but... I tried to reduce a redundant work and to avoid duplicating functionality. I think I should search other way
  2. VoidSpirit

    Assigning property without a setter

    to Jason Goepel: Yes, I know. But property type (class TName in example) has some different assigning methods, and in this case I must write same number of setters. Or write setter with variable type parameter. I don't want duplicate assigning methods by setters. How can I write variable type setter, or solve it by other way?
  3. VoidSpirit

    Assigning property without a setter

    Good day! I have an application class with property which is object too:   // C class class Foo {TName * name; // TName is class  TName * get_name(); // for registering as getter }; I'm registering a getter for 'name': TName & get_name(); Class TName has 'opAssign' methods for different types.   Now I'm trying to create a Foo class object and assign 'name' value using TName assign methods: Foo foo(); foo.name = "TEST" foo.name = anything else... And I have an error 'Property 'name' has no setter'. But next code is legal: foo.get_name() = "TEST" // here working TName.opAssign I want keep a TName assigning functionality without complicated setters in Foo class. How can I legally write it?
  4. VoidSpirit

    Interception of method call

    Thank you! It was a reserve variant. I will most likely use it
  5. VoidSpirit

    Interception of method call

    Thank you for answer! But, as I understand, reflection does not solve this problem. In example code above 'selector' is an application class that has neither method 'foo' no other methods linking it to other classes. Selector does not know about other classes. I want it can dynamically intersept any-named method call and translate it to call of methods of enumerated objects. Any linking must be realized at run-time. Desired mechanics:   I write at script: selector s=selector(); s.bind(object_1); ... s.bind(object_n); s.move(0,0); // example method call. selector has no method 'move', and not all objects have. But an application can get this call as information about the name of called method and actual parameters, take each binded object, find same method 'move' in it and try to call it.   At current time code 's.move(0,0)' of course cases a compile-time error.
  6. VoidSpirit

    Interception of method call

    Hello! I have new question. Is there an ability to intercept an object's arbitrary method call or access to object's properties? In details: I have a class 'selector' incapsulating mechanics of enumeration and selection of objects of different classes. I'm interesting in ability to call same-named methods of group of objects by calling an fictitious method of selector. Selector must translate it to calls of methods of enumerated objects with actual arguments list. Set of methods unknown at compile time and it's impossible to make needed selector's methods. For example:   // selector selector s=s(); // initialize 's' selector, bind it to some objects ... // call all objects methods s.foo("test",12); // foo methods of all enumerated object same signatures will be called   If there is a combination of Angel Script mechanics, overloaded operators etc, it would be very usefull for me. Best way is to intercept method's call with information of method's name, types and values of arguments and returning value.
  7. VoidSpirit

    Using enum constants in initialization list

    I have verified my code with list initializations. Sorry, my bad - i tryed to add implicit casting to CScriptDictValue and it had cause confusion. Thanks for you answers!
  8. VoidSpirit

    opCast and opConv differences

    Thank you! I'll continue my studies and I think it was not last question...
  9. VoidSpirit

    opCast and opConv differences

    I look at CScriptDictValue code and see both opCast and opConv operations reference to CScriptDictValue_opCast writing a value to prepared stack place.  In your example: - casting to int - by opConv - casting to obj - by opCast can I write: int val=cast<int>(dict['value']); @handle = obj(dict['handle']); or not and why? What does determine choice between opConv and opCast?
  10. VoidSpirit

    Using enum constants in initialization list

    OK, I'll certainly try it, but I need few days to restore and compile my project
  11. VoidSpirit

    opCast and opConv differences

    Hello!   What are differences between opCast and opConv operations? How they are differs internally? On which data types I must use cast<type> operation, and when - type(...) ? Can I safely use both operations in all case or an application's crash may occurs?   At last - what operation I must use for getting values from DictionaryValue for different storing types?   Thanks for answers
  12. VoidSpirit

    Using enum constants in initialization list

    Thanks for answer! I solved it (it works). Really it for dictionary type: in buffer constructor adding code fragment for enum type in buffer:   if( typeId >= asTYPEID_INT8 && typeId <= asTYPEID_DOUBLE ) {... } // ADDED: else if(engine->GetTypeInfoById(typeId)->GetFlags() & asOBJ_ENUM) {typeId=asTYPEID_UINT32; Set(name, (asINT64)*(unsigned int*)ref); }   I think for other containers it is same case.
  13. Hello!   I'm registering some enums, i.e. TmColors = {clWhite, clBlack etc...} and trying to use it in initialization lists:   array<int> a={clWhite,clBlack};   and have no result - array elements are empty. What i do wrong?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!