1// Copyright 2017 PDFium 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// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef FXJS_CJS_RETURN_H_
8#define FXJS_CJS_RETURN_H_
9
10#include "fxjs/fxjs_v8.h"
11
12class CJS_Return {
13 public:
14  explicit CJS_Return(bool);
15  explicit CJS_Return(const WideString&);
16  explicit CJS_Return(v8::Local<v8::Value>);
17  CJS_Return(const CJS_Return&);
18  ~CJS_Return();
19
20  bool HasError() const { return is_error_; }
21  WideString Error() const { return error_; }
22
23  bool HasReturn() const { return !return_.IsEmpty(); }
24  v8::Local<v8::Value> Return() const { return return_; }
25
26 private:
27  CJS_Return() = delete;
28
29  bool is_error_ = false;
30  WideString error_;
31  v8::Local<v8::Value> return_;
32};
33
34#endif  // FXJS_CJS_RETURN_H_
35