/* $Revision: 11 $ $Date: 3/11/04 21:51 $ Copyright © 1999-2003, FSL Technologies Limited. Contact "http://fost3.fsltech.com". */ #include "stdafx.h" #include #include using namespace std; using namespace FSLib; using namespace FSLib::Exceptions; namespace { Revision c_revision( L"$Archive: /FOST.3/F3Util/scheme.cpp $", __DATE__, L"$Revision: 11 $", L"$Date: 3/11/04 21:51 $" ); const wchar_t InvalidSchemeMsg[]=L"Invalid scheme (Internet protocol)"; map< t_port, FSLib::wstring > &g_byPort() { static map< t_port, FSLib::wstring > byPort; return byPort; } map< FSLib::wstring, t_port > &g_byName() { static map< FSLib::wstring, t_port > byName; return byName; } inline const FSLib::wstring &fromPort( t_port port ) { map< t_port, FSLib::wstring >::const_iterator pos( g_byPort().find( port ) ); if ( pos == g_byPort().end() ) { throw InvalidScheme( L"Could not find a scheme with the given port number" ); } return (*pos).second; } inline t_port fromMonicker( const FSLib::wstring &name ) { map< FSLib::wstring, t_port >::const_iterator pos( g_byName().find( name ) ); if ( pos == g_byName().end() ) { throw InvalidScheme( L"Could not find a scheme with the given name" ); } return (*pos).second; } const SchemePort c_ftp( L"ftp", 21 ); } /* Exceptions */ inline InvalidScheme::InvalidScheme( const FSLib::wstring &message ) : Exception( message ) { } inline const wchar_t * const InvalidScheme::message() const { return InvalidSchemeMsg; } /* SchemePort */ inline SchemePort::SchemePort( const FSLib::wstring &s, t_port p ) : m_monicker( s ), m_port( p ) { g_byPort().insert( make_pair( p, s ) ); g_byName().insert( make_pair( s, p ) ); } inline const FSLib::wstring &SchemePort::monicker() const { return m_monicker; } inline t_port SchemePort::port() const { return m_port; } /* Scheme instance members */ inline Scheme::Scheme( const FSLib::wstring &name ) : m_name( name ), m_port( fromMonicker( name ) ) { } inline Scheme::Scheme( const FSLib::wstring &name, t_port port ) : m_name( name ), m_port( port ) { } inline t_port Scheme::port() const { return m_port; } inline FSLib::wstring Scheme::monicker() const { return m_name; } /* $History: scheme.cpp $ * * ***************** Version 11 ***************** * User: Kirit Date: 3/11/04 Time: 21:51 * Updated in $/FOST.3/F3Util * First working version of FSLib::wstring using UTF-16. * * ***************** Version 10 ***************** * User: Kirit Date: 9/10/03 Time: 15:44 * Updated in $/FOST.3/F3Util * Headers re-arranged to give a proper SDK feel and to make determination * of required headers simpler. * * ***************** Version 8 ***************** * User: Kirit Date: 4/10/03 Time: 15:40 * Updated in $/FOST.3/F3Util * Internet library now added to F3Util.DLL (including use of newer * version of SSLeay). * * ***************** Version 7 ***************** * User: Kirit Date: 3/10/03 Time: 16:09 * Updated in $/FOST/Cpp/FSInternet * Added stdafx.h and stdafx.cpp pre-compiled header support. * * ***************** Version 6 ***************** * User: Kirit Date: 7/05/02 Time: 12:01 * Updated in $/FOST/Cpp/FSInternet * 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 5 ***************** * User: Kirit Date: 19/03/02 Time: 20:54 * Updated in $/FOST/Cpp/FSInternet * Corrected history from last check-in. * Updated TestAX.IDL to remove registry entries from removed classes. * * ***************** Version 4 ***************** * User: Kirit Date: 19/03/02 Time: 19:48 * Updated in $/FOST/Cpp/FSInternet * 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 3 ***************** * User: Kirit Date: 22/10/01 Time: 15:45 * Updated in $/FOST/FSInternet * Working HTTP protocol class. * * ***************** Version 2 ***************** * User: Kirit Date: 13/10/01 Time: 20:08 * Updated in $/FOST/FSInternet * Addition of Url class. * * ***************** Version 1 ***************** * User: Kirit Date: 13/10/01 Time: 18:42 * Created in $/FOST/FSInternet */