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...
 
local getPackageUrl ()
 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 ()

Protected Member Functions

 Manifest (const std::string &manifestUrl="")
 Constructor for Manifest class. More...
 
 Manifest ()
 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...
 
local getGroups ()
 Gets all groups. More...
 
const std::unordered_map
< std::string, std::string > & 
getGroupVerions () const
 Gets all groups version. More...
 
var getGroupVerions ()
 Gets all groups version. More...
 
local getGroupVerions ()
 Gets all groups version. More...
 
const std::string & getGroupVersion (const std::string &group) const
 Gets version for the given group. More...
 
local getGroupVersion ( local group)
 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...
 
var setAssetDownloadState ( var key, var state)
 Set the download state for an asset. More...
 
local setAssetDownloadState ( local key, local 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 
var DiffType
strong

The type of difference.

Enumerator
ADDED 
DELETED 
MODIFIED 
local DiffType
strong

The type of difference.

Enumerator
ADDED 
DELETED 
MODIFIED 
enum DownloadState
strong
Enumerator
UNSTARTED 
DOWNLOADING 
SUCCESSED 
var DownloadState
strong
Enumerator
UNSTARTED 
DOWNLOADING 
SUCCESSED 
local 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
var Manifest ( var  manifestUrl = "")
protected

Constructor for Manifest class.

Parameters
manifestUrlUrl of the local manifest
local Manifest ( local  manifestUrl = "")
protected

Constructor for Manifest class.

Parameters
manifestUrlUrl of the local manifest

Member Function Documentation

void clear ( )
protected
var clear ( )
protected
local 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
var genDiff ( var  b)
protected

Generate difference between this Manifest and another.

Parameters
bThe other manifest
local genDiff ( local  b)
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
var genResumeAssetsList ( var  units)
protected

Generate resuming download assets list.

Parameters
unitsThe download units reference to be modified by the generation result
local genResumeAssetsList ( local  units)
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.

var getAssets ( )
protected

Gets assets.

local getAssets ( )
protected

Gets assets.

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

Gets all groups.

var getGroups ( )
protected

Gets all groups.

local getGroups ( )
protected

Gets all groups.

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

Gets all groups version.

var getGroupVerions ( )
protected

Gets all groups version.

local getGroupVerions ( )
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
var getGroupVersion ( var  group)
protected

Gets version for the given group.

Parameters
groupKey of the requested group
local getGroupVersion ( local  group)
protected

Gets version for the given group.

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

Gets remote manifest file url.

var getManifestFileUrl ( )

Gets remote manifest file url.

local getManifestFileUrl ( )

Gets remote manifest file url.

const std::string& getPackageUrl ( ) const

Gets remote package url.

var getPackageUrl ( )

Gets remote package url.

local getPackageUrl ( )

Gets remote package url.

const std::string& getVersion ( ) const

Gets manifest version.

var getVersion ( )

Gets manifest version.

local getVersion ( )

Gets manifest version.

const std::string&
getVersionFileUrl
( ) const

Gets remote version file url.

var getVersionFileUrl ( )

Gets remote version file url.

local getVersionFileUrl ( )

Gets remote version file url.

bool isLoaded ( ) const

Check whether the manifest have been fully loaded.

var isLoaded ( )

Check whether the manifest have been fully loaded.

local isLoaded ( )

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
var loadJson ( var  url)
protected

Load the json file into local json object.

Parameters
urlUrl of the json file
local loadJson ( local  url)
protected

Load the json file into local json object.

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

Parse the manifest file information into this manifest.

Parameters
manifestUrlUrl of the local manifest
var parse ( var  manifestUrl)
protected

Parse the manifest file information into this manifest.

Parameters
manifestUrlUrl of the local manifest
local parse ( local  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
var parseAsset ( var  path,
var  json 
)
protected
local parseAsset ( local  path,
local  json 
)
protected
void parseVersion ( const std::string &  versionUrl)
protected

Parse the version file information into this manifest.

Parameters
versionUrlUrl of the local version file
var parseVersion ( var  versionUrl)
protected

Parse the version file information into this manifest.

Parameters
versionUrlUrl of the local version file
local parseVersion ( local  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.

var prependSearchPaths ( )
protected

Prepend all search paths to the FileUtils.

local prependSearchPaths ( )
protected

Prepend all search paths to the FileUtils.

void saveToFile ( const std::string &  filepath)
protected
var saveToFile ( var  filepath)
protected
local saveToFile ( local  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
var setAssetDownloadState ( var  key,
var  state 
)
protected

Set the download state for an asset.

Parameters
keyKey of the asset to set
stateThe current download state of the asset
local setAssetDownloadState ( local  key,
local  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
var versionEquals ( var  b)
protected

Check whether the version of this manifest equals to another.

Parameters
bThe other manifest
local versionEquals ( local  b)
protected

Check whether the version of this manifest equals to another.

Parameters
bThe other manifest

Friends And Related Function Documentation

friend class AssetsManagerEx
friend
var AssetsManagerEx
friend
local AssetsManagerEx
friend

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