[sanexx-commit] SF.net SVN: sanexx: [12]
Status: Pre-Alpha
Brought to you by:
paddy_hack
|
From: <pad...@us...> - 2006-03-06 11:29:57
|
Revision: 12 Author: paddy_hack Date: 2006-03-06 03:29:46 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/sanexx/?rev=12&view=rev Log Message: ----------- r23@qed: olaf | 2006-03-04 17:38:04 +0900 Moved the device::info class definition out of device for clarity. Dumped individual member variables in favour of a reference to the SANE_Device * to avoid memory wastage. Adjusted accessors to make them return copies of the fields instead of constant references. Modified Paths: -------------- trunk/include/sane++ trunk/lib/sane++.cc Property Changed: ---------------- / Property changes on: ___________________________________________________________________ Name: svk:merge - 52428bda-890d-0410-88ad-be188b7e1831:/local:22 + 52428bda-890d-0410-88ad-be188b7e1831:/local:23 Modified: trunk/include/sane++ =================================================================== --- trunk/include/sane++ 2006-03-06 11:29:31 UTC (rev 11) +++ trunk/include/sane++ 2006-03-06 11:29:46 UTC (rev 12) @@ -35,34 +35,35 @@ using std::ostream; using std::string; +void init (void); +void exit (void); + class device { public: - class info - { - public: - info (const SANE_Device *dev_info); + class info; +}; - const string& name () const; - const string& vendor () const; - const string& model () const; - const string& type () const; +list<device::info> get_devices (void); - private: - string _name; - string _vendor; - string _model; - string _type; - }; -}; +class device::info +{ +public: + string name () const; + string vendor () const; + string model () const; + string type () const; -void init (void); -void exit (void); +private: + const SANE_Device *_dev_info; -list<device::info> get_devices (void); + info (const SANE_Device *dev_info); -ostream& operator<< (ostream& os, const device::info& i); + friend list<device::info> get_devices (void); +}; +ostream& operator<< (ostream& os, const device::info& dev_info); + } // namespace sane #endif /* !included_sanexx */ Modified: trunk/lib/sane++.cc =================================================================== --- trunk/lib/sane++.cc 2006-03-06 11:29:31 UTC (rev 11) +++ trunk/lib/sane++.cc 2006-03-06 11:29:46 UTC (rev 12) @@ -61,45 +61,42 @@ } - device::info::info (const SANE_Device *dev_info) - : _name (dev_info->name), - _vendor (dev_info->vendor), - _model (dev_info->model), - _type (dev_info->type) -{ -} - -const string& +string device::info::name () const { - return _name; + return _dev_info->name; } -const string& +string device::info::vendor () const { - return _vendor; + return _dev_info->vendor; } -const string& +string device::info::model () const { - return _model; + return _dev_info->model; } -const string& +string device::info::type () const { - return _type; + return _dev_info->type; } +device::info::info (const SANE_Device *dev_info) + : _dev_info (dev_info) +{ +} + ostream& -operator<< (ostream& os, const device::info& i) +operator<< (ostream& os, const device::info& dev_info) { - return os << i.name () - << i.vendor () - << i.model () - << i.type (); + return os << dev_info.name () + << dev_info.vendor () + << dev_info.model () + << dev_info.type (); } } // namespace sane This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |