firebase::storage::Metadata

#include <metadata.h>

Metadata stores default attributes such as size and content type.

Summary

Metadata for a StorageReference. You may also store custom metadata key value pairs. Metadata values may be used to authorize operations using declarative validation rules.

Constructors and Destructors

Metadata()
Create a default Metadata that you can modify and use.
Metadata(const Metadata & other)
Copy constructor.
Metadata(Metadata && other)
Move constructor.
~Metadata()

Public functions

GetReference() const
Return the associated StorageReference to which this Metadata belongs.
bucket() const
const char *
Return the owning Google Cloud Storage bucket for the StorageReference.
cache_control() const
const char *
Return the Cache Control setting of the StorageReference.
content_disposition() const
const char *
Return the content disposition of the StorageReference.
content_encoding() const
const char *
Return the content encoding for the StorageReference.
content_language() const
const char *
Return the content language for the StorageReference.
content_type() const
const char *
Return the content type of the StorageReference.
creation_time() const
int64_t
Return the time the StorageReference was created in milliseconds since the epoch.
custom_metadata() const
std::map< std::string, std::string > *
Return a map of custom metadata key value pairs.
generation() const
int64_t
Return a version String indicating what version of the StorageReference.
is_valid() const
bool
Returns true if this Metadata is valid, false if it is not valid.
md5_hash() const
const char *
MD5 hash of the data; encoded using base64.
metadata_generation() const
int64_t
Return a version String indicating the version of this StorageMetadata.
name() const
const char *
Return a simple name of the StorageReference object.
operator=(const Metadata & other)
Copy assignment operator.
operator=(Metadata && other)
Move assignment operator.
path() const
const char *
Return the path of the StorageReference object.
set_cache_control(const char *cache_control)
void
Set the Cache Control setting of the StorageReference.
set_cache_control(const std::string & cache_control)
void
Set the Cache Control setting of the StorageReference.
set_content_disposition(const char *disposition)
void
Set the content disposition of the StorageReference.
set_content_disposition(const std::string & disposition)
void
Set the content disposition of the StorageReference.
set_content_encoding(const char *encoding)
void
Set the content encoding for the StorageReference.
set_content_encoding(const std::string & encoding)
void
Set the content encoding for the StorageReference.
set_content_language(const char *language)
void
Set the content language for the StorageReference.
set_content_language(const std::string & language)
void
Set the content language for the StorageReference.
set_content_type(const char *type)
void
Set the content type of the StorageReference.
set_content_type(const std::string & type)
void
Set the content type of the StorageReference.
size_bytes() const
int64_t
Return the stored Size in bytes of the StorageReference object.
updated_time() const
int64_t
Return the time the StorageReference was last updated in milliseconds since the epoch.

Public functions

GetReference

StorageReference GetReference() const 

Return the associated StorageReference to which this Metadata belongs.

Details
Returns
The associated StorageReference to which this Metadata belongs. If this Metadata is invalid or is not associated with any file, an invalid StorageReference is returned.

Metadata

 Metadata()

Create a default Metadata that you can modify and use.

Metadata

 Metadata(
  const Metadata & other
)

Copy constructor.

Details
Parameters
other
Metadata to copy from.

Metadata

 Metadata(
  Metadata && other
)

Move constructor.

Moving is an efficient operation for Metadata.

Details
Parameters
other
Metadata to move from.

bucket

const char * bucket() const 

Return the owning Google Cloud Storage bucket for the StorageReference.

Details
Returns
The owning Google Cloud Storage bucket for the StorageReference.

cache_control

const char * cache_control() const 

Return the Cache Control setting of the StorageReference.

See also: https://tools.ietf.org/html/rfc7234#section-5.2

Details
Returns
The Cache Control setting of the StorageReference.

content_disposition

const char * content_disposition() const 

Return the content disposition of the StorageReference.

See also: https://tools.ietf.org/html/rfc6266

Details
Returns
The content disposition of the StorageReference.

content_encoding

const char * content_encoding() const 

Return the content encoding for the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.11

Details
Returns
The content encoding for the StorageReference.

content_language

const char * content_language() const 

Return the content language for the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.12

Details
Returns
The content language for the StorageReference.

content_type

const char * content_type() const 

Return the content type of the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.17

Details
Returns
The content type of the StorageReference.

creation_time

int64_t creation_time() const 

Return the time the StorageReference was created in milliseconds since the epoch.

Details
Returns
The time the StorageReference was created in milliseconds since the epoch.

custom_metadata

std::map< std::string, std::string > * custom_metadata() const 

Return a map of custom metadata key value pairs.

The pointer returned is only valid during the lifetime of the Metadata object that owns it.

Details
Returns
The keys for custom metadata.

generation

int64_t generation() const 

Return a version String indicating what version of the StorageReference.

Details
Returns
A value indicating the version of the StorageReference.

is_valid

bool is_valid() const 

Returns true if this Metadata is valid, false if it is not valid.

An invalid Metadata is returned when a method such as StorageReference::GetMetadata() completes with an error.

Details
Returns
true if this Metadata is valid, false if this Metadata is invalid.

md5_hash

const char * md5_hash() const 

MD5 hash of the data; encoded using base64.

Details
Returns
MD5 hash of the data; encoded using base64.

metadata_generation

int64_t metadata_generation() const 

Return a version String indicating the version of this StorageMetadata.

Details
Returns
A value indicating the version of this StorageMetadata.

name

const char * name() const 

Return a simple name of the StorageReference object.

Details
Returns
A simple name of the StorageReference object.

operator=

Metadata & operator=(
  const Metadata & other
)

Copy assignment operator.

Details
Parameters
other
Metadata to copy from.
Returns
Reference to the destination Metadata.

operator=

Metadata & operator=(
  Metadata && other
)

Move assignment operator.

Moving is an efficient operation for Metadata.

Details
Parameters
other
Metadata to move from.
Returns
Reference to the destination Metadata.

path

const char * path() const 

Return the path of the StorageReference object.

Details
Returns
The path of the StorageReference object.

set_cache_control

void set_cache_control(
  const char *cache_control
)

Set the Cache Control setting of the StorageReference.

See also: https://tools.ietf.org/html/rfc7234#section-5.2

set_cache_control

void set_cache_control(
  const std::string & cache_control
)

Set the Cache Control setting of the StorageReference.

See also: https://tools.ietf.org/html/rfc7234#section-5.2

set_content_disposition

void set_content_disposition(
  const char *disposition
)

Set the content disposition of the StorageReference.

See also: https://tools.ietf.org/html/rfc6266

set_content_disposition

void set_content_disposition(
  const std::string & disposition
)

Set the content disposition of the StorageReference.

See also: https://tools.ietf.org/html/rfc6266

set_content_encoding

void set_content_encoding(
  const char *encoding
)

Set the content encoding for the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.11

set_content_encoding

void set_content_encoding(
  const std::string & encoding
)

Set the content encoding for the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.11

set_content_language

void set_content_language(
  const char *language
)

Set the content language for the StorageReference.

See also: https://tools.ietf.org/html/rfc2616#section-14.12

set_content_language

void set_content_language(
  const std::string & language
)

Set the content language for the StorageReference.

This must be an ISO 639-1 two-letter language code. E.g. "zh", "es", "en".

See also: https://www.loc.gov/standards/iso639-2/php/code_list.php

set_content_type

void set_content_type(
  const char *type
)

set_content_type

void set_content_type(
  const std::string & type
)

size_bytes

int64_t size_bytes() const 

Return the stored Size in bytes of the StorageReference object.

Details
Returns
The stored Size in bytes of the StorageReference object.

updated_time

int64_t updated_time() const 

Return the time the StorageReference was last updated in milliseconds since the epoch.

Details
Returns
The time the StorageReference was last updated in milliseconds since the epoch.

~Metadata

 ~Metadata()