Loading...
Searching...
No Matches
filesystemWritableAsset.h
Go to the documentation of this file.
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_USD_AR_FILESYSTEM_WRITABLE_ASSET_H
7#define PXR_USD_AR_FILESYSTEM_WRITABLE_ASSET_H
8
10
11#include "pxr/pxr.h"
12#include "pxr/usd/ar/api.h"
13#include "pxr/usd/ar/resolver.h"
15
17
18PXR_NAMESPACE_OPEN_SCOPE
19
30 : public ArWritableAsset
31{
32public:
36 AR_API
37 static std::shared_ptr<ArFilesystemWritableAsset> Create(
38 const ArResolvedPath& resolvedPath,
39 ArResolver::WriteMode writeMode);
40
43 AR_API
45
46 AR_API
48
52 AR_API
53 virtual bool Close() override;
54
58 AR_API
59 virtual size_t Write(
60 const void* buffer, size_t count, size_t offset) override;
61
62private:
63 TfSafeOutputFile _file;
64};
65
66PXR_NAMESPACE_CLOSE_SCOPE
67
68#endif
ArWritableAsset implementation for asset represented by a file on a filesystem.
virtual AR_API size_t Write(const void *buffer, size_t count, size_t offset) override
Writes count bytes from buffer at offset from the beginning of the file held by this object.
AR_API ArFilesystemWritableAsset(TfSafeOutputFile &&file)
Constructs an ArFilesystemWritableAsset for the given file.
virtual AR_API bool Close() override
Closes the file owned by this asset.
static AR_API std::shared_ptr< ArFilesystemWritableAsset > Create(const ArResolvedPath &resolvedPath, ArResolver::WriteMode writeMode)
Constructs a new ArFilesystemWritableAsset for the file at resolvedPath with the given writeMode.
Represents a resolved asset path.
Definition: resolvedPath.h:23
WriteMode
Enumeration of write modes for OpenAssetForWrite.
Definition: resolver.h:295
Interface for writing data to an asset.
Definition: writableAsset.h:27
Opens a file for output, either for update "r+" or to completely replace "w+".
Safe file writer with FILE * interface.