Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
temp_file.h
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// emulates g3/file/util/temp_file.h
15#ifndef ORTOOLS_BASE_TEMP_FILE_H_
16#define ORTOOLS_BASE_TEMP_FILE_H_
17
18#include <string>
19
20#include "absl/status/statusor.h"
21#include "absl/strings/string_view.h"
22
23namespace file {
24
25// The following functions return a temporary-looking filename.
26// Note that the pattern of the generated filenames is subject to change.
27
28// Returns a unique filename in 'directory' (which can be followed or not by a
29// "/"). Unique filenames begin with the given file_prefix followed by a unique
30// string.
31// If 'directory' is empty a local scratch directory is selected.
32// If 'file_prefix' is empty a default prefix is used.
33::absl::StatusOr<std::string> MakeTempFilename(absl::string_view directory,
34 absl::string_view file_prefix);
35
36} // namespace file
37
38#endif // ORTOOLS_BASE_TEMP_FILE_H_
Definition file.cc:327
::absl::StatusOr< std::string > MakeTempFilename(absl::string_view directory, absl::string_view file_prefix)
Definition temp_file.cc:33