xref: /aosp_15_r20/external/sandboxed-api/sandboxed_api/var_void.h (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SANDBOXED_API_VAR_VOID_H_
16 #define SANDBOXED_API_VAR_VOID_H_
17 
18 #include <cstddef>
19 #include <memory>
20 #include <string>
21 
22 #include "sandboxed_api/var_ptr.h"
23 #include "sandboxed_api/var_reg.h"
24 
25 namespace sapi::v {
26 
27 // Good, old void.
28 class Void : public Callable {
29  public:
30   Void() = default;
31 
GetSize()32   size_t GetSize() const final { return 0U; }
GetType()33   Type GetType() const final { return Type::kVoid; }
GetTypeString()34   std::string GetTypeString() const final { return "Void"; }
ToString()35   std::string ToString() const final { return "Void"; }
36 
GetDataPtr()37   const void* GetDataPtr() override { return nullptr; }
SetDataFromPtr(const void * ptr,size_t max_sz)38   void SetDataFromPtr(const void* ptr, size_t max_sz) override {}
39 };
40 
41 }  // namespace sapi::v
42 
43 #endif  // SANDBOXED_API_VAR_VOID_H_
44