Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/node/v8-data.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright 2021 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
0004 
0005 #ifndef INCLUDE_V8_DATA_H_
0006 #define INCLUDE_V8_DATA_H_
0007 
0008 #include "v8-local-handle.h"  // NOLINT(build/include_directory)
0009 #include "v8config.h"         // NOLINT(build/include_directory)
0010 
0011 namespace v8 {
0012 
0013 class Context;
0014 
0015 /**
0016  * The superclass of objects that can reside on V8's heap.
0017  */
0018 class V8_EXPORT Data {
0019  public:
0020   /**
0021    * Returns true if this data is a |v8::Value|.
0022    */
0023   bool IsValue() const;
0024 
0025   /**
0026    * Returns true if this data is a |v8::Module|.
0027    */
0028   bool IsModule() const;
0029 
0030   /**
0031    * Returns tru if this data is a |v8::FixedArray|
0032    */
0033   bool IsFixedArray() const;
0034 
0035   /**
0036    * Returns true if this data is a |v8::Private|.
0037    */
0038   bool IsPrivate() const;
0039 
0040   /**
0041    * Returns true if this data is a |v8::ObjectTemplate|.
0042    */
0043   bool IsObjectTemplate() const;
0044 
0045   /**
0046    * Returns true if this data is a |v8::FunctionTemplate|.
0047    */
0048   bool IsFunctionTemplate() const;
0049 
0050   /**
0051    * Returns true if this data is a |v8::Context|.
0052    */
0053   bool IsContext() const;
0054 
0055  private:
0056   Data() = delete;
0057 };
0058 
0059 /**
0060  * A fixed-sized array with elements of type Data.
0061  */
0062 class V8_EXPORT FixedArray : public Data {
0063  public:
0064   int Length() const;
0065   Local<Data> Get(Local<Context> context, int i) const;
0066 
0067   V8_INLINE static FixedArray* Cast(Data* data) {
0068 #ifdef V8_ENABLE_CHECKS
0069     CheckCast(data);
0070 #endif
0071     return reinterpret_cast<FixedArray*>(data);
0072   }
0073 
0074  private:
0075   static void CheckCast(Data* obj);
0076 };
0077 
0078 }  // namespace v8
0079 
0080 #endif  // INCLUDE_V8_DATA_H_