Loading...
Searching...
No Matches
filesystemWritableAsset.h
Go to the documentation of this file.
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23#ifndef PXR_USD_AR_FILESYSTEM_WRITABLE_ASSET_H
24#define PXR_USD_AR_FILESYSTEM_WRITABLE_ASSET_H
25
27
28#include "pxr/pxr.h"
29#include "pxr/usd/ar/api.h"
30#include "pxr/usd/ar/resolver.h"
32
34
35PXR_NAMESPACE_OPEN_SCOPE
36
47 : public ArWritableAsset
48{
49public:
53 AR_API
54 static std::shared_ptr<ArFilesystemWritableAsset> Create(
55 const ArResolvedPath& resolvedPath,
56 ArResolver::WriteMode writeMode);
57
60 AR_API
62
63 AR_API
65
69 AR_API
70 virtual bool Close() override;
71
75 AR_API
76 virtual size_t Write(
77 const void* buffer, size_t count, size_t offset) override;
78
79private:
80 TfSafeOutputFile _file;
81};
82
83PXR_NAMESPACE_CLOSE_SCOPE
84
85#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:40
WriteMode
Enumeration of write modes for OpenAssetForWrite.
Definition: resolver.h:312
Interface for writing data to an asset.
Definition: writableAsset.h:44
Opens a file for output, either for update "r+" or to completely replace "w+".
Safe file writer with FILE * interface.