cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Manifest Class Reference

#include <Manifest.h>

Inheritance diagram for Manifest:
Ref

Classes

struct  Asset
 Asset object. More...
 
struct  AssetDiff
 Object indicate the difference between two Assets. More...
 

Public Types

enum  DiffType { ADDED, DELETED, MODIFIED }
 The type of difference. More...
 
enum  DownloadState { UNSTARTED, DOWNLOADING, SUCCESSED }
 

Public Member Functions

bool isVersionLoaded () const
 Check whether the version informations have been fully loaded. More...
 
bool isLoaded () const
 Check whether the manifest have been fully loaded. More...
 
const std::string & getPackageUrl () const
 Gets remote package url. More...
 
const std::string & getManifestFileUrl () const
 Gets remote manifest file url. More...
 
const std::string & getVersionFileUrl () const
 Gets remote version file url. More...
 
const std::string & getVersion () const
 Gets manifest version. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 NA NA More...
 

Protected Member Functions

 Manifest (const std::string &manifestUrl="")
 Constructor for Manifest class. More...
 
void loadJson (const std::string &url)
 Load the json file into local json object. More...
 
void parseVersion (const std::string &versionUrl)
 Parse the version file information into this manifest. More...
 
void parse (const std::string &manifestUrl)
 Parse the manifest file information into this manifest. More...
 
bool versionEquals (const Manifest *b) const
 Check whether the version of this manifest equals to another. More...
 
std::unordered_map
< std::string, AssetDiff
genDiff (const Manifest *b) const
 Generate difference between this Manifest and another. More...
 
void genResumeAssetsList (Downloader::DownloadUnits *units) const
 Generate resuming download assets list. More...
 
void prependSearchPaths ()
 Prepend all search paths to the FileUtils. More...
 
void loadVersion (const rapidjson::Document &json)
 
void loadManifest (const rapidjson::Document &json)
 
void saveToFile (const std::string &filepath)
 
Asset parseAsset (const std::string &path, const rapidjson::Value &json)
 
void clear ()
 
const std::vector< std::string > & getGroups () const
 Gets all groups. More...
 
const std::unordered_map
< std::string, std::string > & 
getGroupVerions () const
 Gets all groups version. More...
 
const std::string & getGroupVersion (const std::string &group) const
 Gets version for the given group. More...
 
const std::unordered_map
< std::string, Asset > & 
getAssets () const
 Gets assets. More...
 
void setAssetDownloadState (const std::string &key, const DownloadState &state)
 Set the download state for an asset. More...
 
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Friends

class AssetsManagerEx
 

Additional Inherited Members

- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Member Enumeration Documentation

enum DiffType
strong

The type of difference.

Enumerator
ADDED 
DELETED 
MODIFIED 
enum DownloadState
strong
Enumerator
UNSTARTED 
DOWNLOADING 
SUCCESSED 

Constructor & Destructor Documentation

Manifest ( const std::string &  manifestUrl = "")
protected

Constructor for Manifest class.

Parameters
manifestUrlUrl of the local manifest

Member Function Documentation

void clear ( )
protected
std::unordered_map<std::string, AssetDiff> genDiff ( const Manifest b) const
protected

Generate difference between this Manifest and another.

Parameters
bThe other manifest
void genResumeAssetsList ( Downloader::DownloadUnits units) const
protected

Generate resuming download assets list.

Parameters
unitsThe download units reference to be modified by the generation result
const std::unordered_map<std::string, Asset>& getAssets ( ) const
protected

Gets assets.

const std::vector<std::string>& getGroups ( ) const
protected

Gets all groups.

const std::unordered_map<std::string, std::string>& getGroupVerions ( ) const
protected

Gets all groups version.

const std::string& getGroupVersion ( const std::string &  group) const
protected

Gets version for the given group.

Parameters
groupKey of the requested group
const std::string& getManifestFileUrl ( ) const

Gets remote manifest file url.

const std::string& getPackageUrl ( ) const

Gets remote package url.

const std::string& getVersion ( ) const

Gets manifest version.

const std::string& getVersionFileUrl ( ) const

Gets remote version file url.

bool isLoaded ( ) const

Check whether the manifest have been fully loaded.

bool isVersionLoaded ( ) const

Check whether the version informations have been fully loaded.

void loadJson ( const std::string &  url)
protected

Load the json file into local json object.

Parameters
urlUrl of the json file
void loadManifest ( const rapidjson::Document &  json)
protected
void loadVersion ( const rapidjson::Document &  json)
protected
void parse ( const std::string &  manifestUrl)
protected

Parse the manifest file information into this manifest.

Parameters
manifestUrlUrl of the local manifest
Asset parseAsset ( const std::string &  path,
const rapidjson::Value &  json 
)
protected
void parseVersion ( const std::string &  versionUrl)
protected

Parse the version file information into this manifest.

Parameters
versionUrlUrl of the local version file
void prependSearchPaths ( )
protected

Prepend all search paths to the FileUtils.

void saveToFile ( const std::string &  filepath)
protected
void setAssetDownloadState ( const std::string &  key,
const DownloadState state 
)
protected

Set the download state for an asset.

Parameters
keyKey of the asset to set
stateThe current download state of the asset
bool versionEquals ( const Manifest b) const
protected

Check whether the version of this manifest equals to another.

Parameters
bThe other manifest

Friends And Related Function Documentation

friend class AssetsManagerEx
friend

The documentation for this class was generated from the following file: