2 * Copyright (C) 2005 Casper S. Hornstrup
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "../rbuild.h"
27 map
<string
,Backend::Factory
*>*
28 Backend::Factory::factories
= NULL
;
30 Backend::Factory::ref
= 0;
32 Backend::Factory::Factory ( const std::string
& name_
)
37 factories
= new map
<string
,Factory
*>;
38 (*factories
)[name
] = this;
41 Backend::Factory::~Factory ()
51 Backend::Factory::Create ( const string
& name
,
53 Configuration
& configuration
)
55 string
sname ( name
);
57 if ( !factories
|| !factories
->size () )
58 throw InvalidOperationException ( __FILE__
,
60 "No registered factories" );
61 Backend::Factory
* f
= (*factories
)[sname
];
64 throw UnknownBackendException ( sname
);
67 return (*f
) ( project
, configuration
);
70 Backend::Backend ( Project
& project
,
71 Configuration
& configuration
)
72 : ProjectNode ( project
),
73 configuration ( configuration
)