/* $Revision: 18 $ $Date: 25/05/05 11:51 $ Copyright © 1999-2005, FSL Technologies Limited. Contact "http://fost3.fsltech.com". */ #include "stdafx.h" #include using namespace std; using namespace FSLib; namespace { Revision c_revision( L"$Archive: /FOST.3/F3Util/id.cpp $", __DATE__, L"$Revision: 18 $", L"$Date: 25/05/05 11:51 $" ); Revision c_header( FOST_ID_HPP_ARCHIVE, __DATE__, FOST_ID_HPP_REVISION, FOST_ID_HPP_DATE ); } /* Library functions */ inline FSLib::wstring Mangling::toSQL< ID >( const ID &field, Mangling::t_translation ) { if ( field.isnull() ) throw Exceptions::Null( L"ID field has not been initialised." ); return field.asString(); } /* ID */ inline ID::ID() : m_id( -1 ) { } inline ID::ID( long i ) : m_id( i ) { if ( i < 1 ) throw FSLib::Exceptions::Null( L"ID initialised from a long cannot be NULL" ); } inline ID::~ID() { } inline bool ID::operator <( const ID &i ) const { return m_id < i.m_id; } inline bool ID::operator >( const ID &i ) const { return m_id > i.m_id; } inline FSLib::wstring ID::asString() const { std::wstringstream sstr; printOn( sstr ); return sstr.str(); } inline std::wostream &ID::printOn( std::wostream &o ) const { return o << m_id; } inline __declspec( dllexport ) std::wostream &FSLib::operator <<( std::wostream &o, const ID &id ) { return id.printOn( o ); } /* $History: id.cpp $ * * ***************** Version 18 ***************** * User: Kirit Date: 25/05/05 Time: 11:51 * Updated in $/FOST.3/F3Util * Added extra 'null' check to ID constructor. * * ***************** Version 17 ***************** * User: Kirit Date: 24/03/05 Time: 18:38 * Updated in $/FOST.3/F3Util * Corrected errors in header file #defines. * * ***************** Version 16 ***************** * User: Kirit Date: 23/03/05 Time: 11:49 * Updated in $/FOST.3/F3Util * Renamed id handling headers to better capture proper intent. * * ***************** Version 15 ***************** * User: Kirit Date: 10/10/03 Time: 10:52 * Updated in $/FOST.3/F3Util * F3Base DLL now builds and registers properly. * * ***************** Version 13 ***************** * User: Kirit Date: 3/10/03 Time: 16:09 * Updated in $/FOST/Cpp/FSID * Added stdafx.h and stdafx.cpp pre-compiled header support. * * ***************** Version 12 ***************** * User: Kirit Date: 20/05/03 Time: 20:49 * Updated in $/FOST/Cpp/FSID * * Added null test for ID. * * Alterations to better ensure that an ID is initialised before it's * value can be taken. * * ***************** Version 11 ***************** * User: Kirit Date: 10/05/03 Time: 13:59 * Updated in $/FOST/Cpp/FSID * ID throws an exception if it hasn't been initialised and a string is * asked for. * * ***************** Version 10 ***************** * User: Kirit Date: 8/10/02 Time: 18:36 * Updated in $/FOST/Cpp/FSID * Support for different translation modes in the database mangling * funcitons. * * ***************** Version 9 ***************** * User: Kirit Date: 5/07/02 Time: 18:40 * Updated in $/FOST/Cpp/FSID * * Altered FSLib::Mangling::toSQL to only handle non-null values and * added nullableToSQL for nullable entries. * * Added COM objects for handling facets of ID, ID pairs (Object owner * pointing to another object). * * Add new values to Demo::ABNAmro::Approval and started facet * implementation to COM instance. * * ***************** Version 8 ***************** * User: Kirit Date: 30/05/02 Time: 11:50 * Updated in $/FOST/Cpp/FSID * Removal of obsolete exception. * * ***************** Version 7 ***************** * User: Kirit Date: 7/05/02 Time: 12:01 * Updated in $/FOST/Cpp/FSID * Wrapped std::basic_string<> in order to change the copy semantics to * stop the problems with using C++ in the COM layer for IIS. * * ***************** Version 6 ***************** * User: Kirit Date: 19/03/02 Time: 20:54 * Updated in $/FOST/Cpp/FSID * Corrected history from last check-in. * Updated TestAX.IDL to remove registry entries from removed classes. * * ***************** Version 5 ***************** * User: Kirit Date: 19/03/02 Time: 19:48 * Updated in $/FOST/Cpp/FSID * Debug compiles now all end in '_d'. * The C++ implementation names (Type.cppName) have been changed to also * include the DLL that the implementation is in as per the documentation. * In all source files the following have been done: * * Ensured that every header file has a revision object. * * Ensured that every translation unit has a revision object. * * Ensured that every source file (which understands comments) * has a history section. * * Changed all copyright notices to be for Obsideon Ltd. * * Changed copyright notices to use the longest possible timeframe. * * ***************** Version 4 ***************** * User: Kirit Date: 20/02/02 Time: 0:55 * Updated in $/FOST/Cpp/FSID * Destructors corrected to give correct behaviour with exceptions. * * ***************** Version 3 ***************** * User: Kirit Date: 17/07/01 Time: 18:02 * Updated in $/FOST/FSID * Addition of FSLib::Mangling::toSQL which takes a Nullable< ID >. * * ***************** Version 2 ***************** * User: Kirit Date: 5/07/01 Time: 17:41 * Updated in $/FOST/FSID * First Unicode only version of FOST. * * ***************** Version 1 ***************** * User: Kirit Date: 27/06/01 Time: 13:30 * Created in $/FOST/FSES */