Public Types | Public Member Functions | List of all members
PoolHelpers::Reference Struct Reference

A lightweight object that encapsulates all different sources for a pool with a hash code and a relative path system. More...

Public Types

enum  Mode {
  Invalid = 0, AbsolutePath, ExpansionPath, ProjectPath,
  EmbeddedResource, LinkToEmbeddedResource
}
 The data sources for the Reference. More...
 

Public Member Functions

InputStream * createInputStream () const
 This creates an input stream for the reference. More...
 
File getFile () const
 If this is a file based reference, it will return the file. More...
 
ProjectHandler::SubDirectories getFileType () const
 Returns the data type. More...
 
int64 getHashCode () const
 Upon creation it creates a hash code that will be used by the pool to identify and return already cached data.
 
Identifier getId () const
 Returns the Identifier as used by the pool. More...
 
Mode getMode () const
 Returns the type of the reference. More...
 
String getReferenceString () const
 Returns the String that was passed in the constructor. More...
 
 operator bool () const
 This can be used to type shorter conditions. More...
 
 Reference ()
 Creates a Invalid reference. More...
 
 Reference (const MainController *mc, const String &referenceStringOrFile, ProjectHandler::SubDirectories directoryType)
 Creates a reference using the given string. More...
 
 Reference (const var &dragDescription)
 Creates a reference from a drag description. More...
 
 Reference (PoolBase *pool, const String &embeddedReference, ProjectHandler::SubDirectories directoryType)
 Creates a reference from an embedded resource. More...
 

Detailed Description

A lightweight object that encapsulates all different sources for a pool with a hash code and a relative path system.

Whenever you need to access external / embedded resources, this class is used to resolve the path / ID to fetch the data.

Normally, you create one of these just with a String and it will figure out automatically whether it's a absolute path, a path relative to the project folder or an embedded resource.

Member Enumeration Documentation

enum Mode

The data sources for the Reference.

Enumerator
Invalid 

if the reference can't be resolved

AbsolutePath 

the reference is an absolute path outside the HISE project folder. This needs to be avoided during development, but for compiled plugins it stores the location to a file specified by the user

ExpansionPath 

if the resource is bundled in an expansion pack, it will be using this value

ProjectPath 

a file within the HISE project folder. This will be transformed into a EmbeddedResource when compiling the plugin

EmbeddedResource 

data that is either embedded in the plugin or shipped as compressed pool data along with the binary

LinkToEmbeddedResource 

???

Constructor & Destructor Documentation

Reference ( )

Creates a Invalid reference.

Reference ( const MainController mc,
const String &  referenceStringOrFile,
ProjectHandler::SubDirectories  directoryType 
)

Creates a reference using the given string.

Reference ( const var &  dragDescription)

Creates a reference from a drag description.

Reference ( PoolBase pool,
const String &  embeddedReference,
ProjectHandler::SubDirectories  directoryType 
)

Creates a reference from an embedded resource.

Member Function Documentation

juce::InputStream * createInputStream ( ) const

This creates an input stream for the reference.

If it's file based, it will be a FileInputStream, and for embedded references you'll get a MemoryInputStream.

juce::File getFile ( ) const

If this is a file based reference, it will return the file.

hise::ProjectHandler::SubDirectories getFileType ( ) const

Returns the data type.

A Reference has the data type baked in it (because you hardly want to load images into a convolution reverb).

juce::Identifier getId ( ) const

Returns the Identifier as used by the pool.

Mode getMode ( ) const
inline

Returns the type of the reference.

juce::String getReferenceString ( ) const

Returns the String that was passed in the constructor.

operator bool ( ) const
inlineexplicit

This can be used to type shorter conditions.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.