1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef FUNCTION_ID_H 6 #define FUNCTION_ID_H 7 8 9 #include <Archivable.h> 10 #include <String.h> 11 12 #include "ObjectID.h" 13 14 15 class FunctionID : public ObjectID, public BArchivable { 16 protected: 17 FunctionID(const BMessage& archive); 18 FunctionID(const BString& path, 19 const BString& functionName); 20 21 public: 22 virtual ~FunctionID(); 23 24 virtual status_t Archive(BMessage* archive, 25 bool deep = true) const; 26 27 const BString& FunctionName() const { return fFunctionName; } 28 29 protected: 30 virtual uint32 ComputeHashValue() const; 31 32 bool IsValid() const; 33 34 protected: 35 BString fPath; 36 BString fFunctionName; 37 }; 38 39 40 class SourceFunctionID : public FunctionID { 41 public: 42 SourceFunctionID(const BMessage& archive); 43 SourceFunctionID(const BString& sourceFilePath, 44 const BString& functionName); 45 virtual ~SourceFunctionID(); 46 47 static BArchivable* Instantiate(BMessage* archive); 48 49 const BString& SourceFilePath() const { return fPath; } 50 51 virtual bool operator==(const ObjectID& other) const; 52 }; 53 54 55 class ImageFunctionID : public FunctionID { 56 public: 57 ImageFunctionID(const BMessage& archive); 58 ImageFunctionID(const BString& imageName, 59 const BString& functionName); 60 virtual ~ImageFunctionID(); 61 62 static BArchivable* Instantiate(BMessage* archive); 63 64 const BString& ImageName() const { return fPath; } 65 66 virtual bool operator==(const ObjectID& other) const; 67 }; 68 69 70 #endif // FUNCTION_ID_H 71