Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » ValueMap
ValueMap [message #12030] Mon, 08 October 2007 23:32
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Based on Bas's code, I am finally coming to introducing ValueMap to U++.

Anyway, there were some problems with his original implementation PLUS I wanted to add ValueArray conversions from/to ValueMap (simply converting the values fron key-value pair).

To this end, I had to change the interface a bit, ending with something like this:

class ValueMap {
public:
	ValueMap();
	ValueMap(const ValueMap& v);
	~ValueMap();

	ValueMap& operator=(const ValueMap& v);

	operator Value() const;
	ValueMap(const Value& src);

	ValueMap(const Nuller&);
	bool IsNullInstance() const                       { return data->IsNull(); }

	void Clear();

	void Put(const Value& key, const Value& value);
	void Remove(const Value& key);

	ValueArray GetKeys() const;
	ValueArray GetValues() const;

	operator ValueArray() const               { return GetValues(); }

	Value operator[](const Value& k) const;

	unsigned GetHashValue() const             { return data->GetHashValue(); }
	void     Serialize(Stream& s);
	String   ToString() const                 { return data->AsString(); }

	bool operator==(const ValueMap& v) const;
	bool operator!=(const ValueMap& v) const  { return !operator==(v); }
}


The question is, if anybody used the original version, will this new one be OK for you?

Mirek
Previous Topic: Optimization Mystery...
Next Topic: Core chat... (reference counted pointers etc.)
Goto Forum:
  


Current Time: Mon Apr 29 11:18:56 CEST 2024

Total time taken to generate the page: 0.02845 seconds