void ApiRegistrar::RegisterProperty( const asITypeInfo& type, const Property& property ) { const size_t nameLength( StringLength( property.name ) + 5u ); char* const accessorName( static_cast<char*>(_alloca( nameLength )) ); if( property.getterFunction ) { const Argument arguments[] = { TypeDescriptor() }; PrintFormatted( accessorName, nameLength, "get_%s", property.name ); RegisterMethod( type, { property.type, Utf8Literal( accessorName ), arguments, true, property.getterFunction } ); } if( property.setterFunction ) { const Argument arguments[] = { Argument( property.type ), TypeDescriptor() }; PrintFormatted( accessorName, nameLength, "set_%s", property.name ); RegisterMethod( type, { property.type, Utf8Literal( accessorName ), arguments, false, property.setterFunction } ); } }
TypeDescriptor TypeParser::parse_types(bool is_reversed) { CassValueType value_type = parse_one_type(); std::list<TypeDescriptor> type_args; bool list_open = false; size_t i; while (index_ < type_buffer_.size() && (i = type_buffer_.find_first_of(",() ", index_)) != std::string::npos) { switch (type_buffer_[i]) { case ' ': ++index_; break; case ',': if (list_open) { CassValueType inner_type = parse_one_type(i); type_args.push_back(TypeDescriptor(inner_type)); } ++index_; break; case '(': list_open = true; ++index_; type_args.push_back(parse_types(false)); break; case ')': { CassValueType inner_type = parse_one_type(i); type_args.push_back(TypeDescriptor(inner_type)); } list_open = false; ++index_; break; default: // unexpected state index_ = type_buffer_.size(); break; } if (!list_open) { break; } } return TypeDescriptor(value_type, is_reversed, type_args); }