Define SG_DEPRECATED, remove unused DEPRECATED.

Use this to mark two Package APIs as deprecated.
This commit is contained in:
James Turner 2017-04-05 22:09:52 +09:00
parent f3e83cf020
commit fe87e7f60d
2 changed files with 22 additions and 20 deletions

View File

@ -109,10 +109,13 @@
# define SG_UNIX # define SG_UNIX
#endif #endif
#if defined( __GNUC__ ) #ifdef __GNUC__
# define DEPRECATED __attribute__ ((deprecated)) #define SG_DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define SG_DEPRECATED(func) __declspec(deprecated) func
#else #else
# define DEPRECATED #pragma message("WARNING: You need to implement SG_DEPRECATED for this compiler")
#define SG_DEPRECATED(func) func
#endif #endif
#if defined(__clang__) #if defined(__clang__)

View File

@ -32,7 +32,7 @@ typedef std::set<std::string> string_set;
namespace simgear namespace simgear
{ {
namespace pkg namespace pkg
{ {
@ -40,13 +40,13 @@ namespace pkg
class Install; class Install;
class Catalog; class Catalog;
class Package; class Package;
typedef SGSharedPtr<Package> PackageRef; typedef SGSharedPtr<Package> PackageRef;
typedef SGSharedPtr<Catalog> CatalogRef; typedef SGSharedPtr<Catalog> CatalogRef;
typedef SGSharedPtr<Install> InstallRef; typedef SGSharedPtr<Install> InstallRef;
typedef std::vector<PackageRef> PackageList; typedef std::vector<PackageRef> PackageList;
class Package : public SGReferenced class Package : public SGReferenced
{ {
public: public:
@ -99,10 +99,10 @@ public:
/** /**
* human-readable name - note this is probably not localised, * human-readable name - note this is probably not localised,
* although this is not ruled out for the future. * although this is not ruled out for the future.
* *
* Deprecated - please use nameForVariant * Deprecated - please use nameForVariant
*/ */
std::string name() const; SG_DEPRECATED(std::string name() const);
/** /**
* Human readable name of a variant * Human readable name of a variant
@ -117,27 +117,27 @@ public:
* Deprecated - please use getLocalisedProp to get the variant-specific * Deprecated - please use getLocalisedProp to get the variant-specific
* description. * description.
*/ */
std::string description() const; SG_DEPRECATED(std::string description() const);
/** /**
* access the raw property data in the package * access the raw property data in the package
*/ */
SGPropertyNode* properties() const; SGPropertyNode* properties() const;
/** /**
* hex-encoded MD5 sum of the download files * hex-encoded MD5 sum of the download files
*/ */
std::string md5() const; std::string md5() const;
std::string getLocalisedProp(const std::string& aName, const unsigned int vIndex = 0) const; std::string getLocalisedProp(const std::string& aName, const unsigned int vIndex = 0) const;
unsigned int revision() const; unsigned int revision() const;
size_t fileSizeBytes() const; size_t fileSizeBytes() const;
CatalogRef catalog() const CatalogRef catalog() const
{ return m_catalog; } { return m_catalog; }
bool matches(const SGPropertyNode* aFilter) const; bool matches(const SGPropertyNode* aFilter) const;
string_set tags() const; string_set tags() const;
@ -184,7 +184,7 @@ public:
* retrieve all the thumbnails for a variant * retrieve all the thumbnails for a variant
*/ */
PreviewVec previewsForVariant(unsigned int vIndex) const; PreviewVec previewsForVariant(unsigned int vIndex) const;
/** /**
* Packages we depend upon. * Packages we depend upon.
* If the dependency list cannot be satisifed for some reason, * If the dependency list cannot be satisifed for some reason,
@ -211,9 +211,9 @@ private:
friend class Catalog; friend class Catalog;
friend class Root; friend class Root;
Package(const SGPropertyNode* aProps, CatalogRef aCatalog); Package(const SGPropertyNode* aProps, CatalogRef aCatalog);
void initWithProps(const SGPropertyNode* aProps); void initWithProps(const SGPropertyNode* aProps);
void updateFromProps(const SGPropertyNode* aProps); void updateFromProps(const SGPropertyNode* aProps);
@ -229,7 +229,7 @@ private:
string_set m_tags; string_set m_tags;
CatalogRef m_catalog; CatalogRef m_catalog;
string_list m_variants; string_list m_variants;
mutable function_list<InstallCallback> _install_cb; mutable function_list<InstallCallback> _install_cb;
}; };
@ -241,4 +241,3 @@ private:
} // of namespace simgear } // of namespace simgear
#endif // of SG_PACKAGE_PACKAGE_HXX #endif // of SG_PACKAGE_PACKAGE_HXX