Home | History | Annotate | Download | only in dev
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef PPAPI_CPP_VAR_RESOURCE_DEV_H_
      6 #define PPAPI_CPP_VAR_RESOURCE_DEV_H_
      7 
      8 #include "ppapi/cpp/resource.h"
      9 #include "ppapi/cpp/var.h"
     10 
     11 /// @file
     12 /// This file defines the API for interacting with resource vars.
     13 
     14 namespace pp {
     15 
     16 class VarResource_Dev : public Var {
     17  public:
     18   /// Constructs a <code>VarResource_Dev</code> given a resource.
     19   explicit VarResource_Dev(const pp::Resource& resource);
     20 
     21   /// Constructs a <code>VarResource_Dev</code> given a var for which
     22   /// is_resource() is true. This will refer to the same resource var, but allow
     23   /// you to access methods specific to resources.
     24   ///
     25   /// @param[in] var A resource var.
     26   explicit VarResource_Dev(const Var& var);
     27 
     28   /// Copy constructor.
     29   VarResource_Dev(const VarResource_Dev& other);
     30 
     31   virtual ~VarResource_Dev();
     32 
     33   /// Assignment operator.
     34   VarResource_Dev& operator=(const VarResource_Dev& other);
     35 
     36   /// The <code>Var</code> assignment operator is overridden here so that we can
     37   /// check for assigning a non-resource var to a <code>VarResource_Dev</code>.
     38   ///
     39   /// @param[in] other The resource var to be assigned.
     40   ///
     41   /// @return The resulting <code>VarResource_Dev</code> (as a
     42   /// <code>Var</code>&).
     43   virtual Var& operator=(const Var& other);
     44 
     45   /// Gets the resource contained in the var.
     46   ///
     47   /// @return The <code>pp::Resource</code> that is contained in the var.
     48   pp::Resource AsResource();
     49 };
     50 
     51 }  // namespace pp
     52 
     53 #endif  // PPAPI_CPP_VAR_RESOURCE_DEV_H_
     54