X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchitecture.h;h=153230244f6aedfdce7fd6a5648619108fe93d12;hb=HEAD;hp=4642080c59307ab897fabb76d22c81d26ea70aed;hpb=d1f9551e05c9d341149eb490e05b1465d3d6b711;p=builder.git diff --git a/source/architecture.h b/source/architecture.h deleted file mode 100644 index 4642080..0000000 --- a/source/architecture.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef ARCHITECTURE_H_ -#define ARCHITECTURE_H_ - -#include -#include -#include "buildinfo.h" -#include "pattern.h" - -class Builder; - -/** -Stores information about an architecture. This includes CPU type, model and -bitness and operating system. -*/ -class Architecture -{ -public: - class Loader: public Msp::DataFile::ObjectLoader - { - public: - Loader(Architecture &); - }; - -private: - Builder &builder; - std::string type; - std::string cpu; - std::string fpu; - std::string system; - unsigned bits = 0; - std::string toolchain; - std::string name; - bool native = false; - std::string cross_prefix; - std::map> filename_patterns; - -public: - Architecture(Builder &b, const std::string &spec); - - const std::string &get_type() const { return type; } - const std::string &get_name() const { return name; } - const std::string &get_system() const { return system; } - unsigned get_bits() const { return bits; } - const std::string &get_cpu() const { return cpu; } - const std::string &get_fpu() const { return fpu; } - const std::string &get_toolchain() const { return toolchain; } - bool match_name(const std::string &, unsigned * = 0) const; - std::string best_match(const std::vector &) const; - bool is_native() const { return native; } - bool is_cross() const { return !cross_prefix.empty(); } - - const std::string &get_cross_prefix() const { return cross_prefix; } - - template - const std::vector &get_patterns() const; - - template - std::string create_filename(const std::string &) const; - -private: - template - void add_pattern(const std::string &); - -private: - static void resolve_aliases(std::vector &); - void parse_specification(const std::string &); -}; - -template -inline const std::vector &Architecture::get_patterns() const -{ - auto i = filename_patterns.find(typeid(T).name()); - if(i!=filename_patterns.end()) - return i->second; - - static std::vector empty; - return empty; -} - -template -inline std::string Architecture::create_filename(const std::string &base) const -{ - const std::vector &patterns = get_patterns(); - return patterns.empty() ? base : patterns.front().apply(base); -} - -#endif