A simple scripting language in C++
Ferenc Szontágh
2025-04-19 bc2e09a3b7a4e414814b56be71ec5c540b8eb4d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// CurlModule: declares a module that provides 'curl' function via libcurl
#ifndef CURLMODULE_CURLMODULE_HPP
#define CURLMODULE_CURLMODULE_HPP
 
#include "Modules/BaseModule.hpp"
#include <vector>
#include "Symbols/Value.hpp"
 
namespace Modules {
 
class CurlModule : public BaseModule {
public:
    /**
     * @brief Register this module's symbols (HTTP GET and POST functions).
     */
    void registerModule() override;
    
    /**
     * @brief Perform HTTP GET: curlGet(url [, options])
     * options is an object with optional fields:
     *   timeout (int or double seconds),
     *   follow_redirects (bool),
     *   headers (object mapping header names to values)
     */
    Symbols::Value curlGet(const std::vector<Symbols::Value>& args);
    
    /**
     * @brief Perform HTTP POST: curlPost(url, data [, options])
     * options is an object with optional fields:
     *   timeout (int or double seconds),
     *   follow_redirects (bool),
     *   headers (object mapping header names to values)
     */
    Symbols::Value curlPost(const std::vector<Symbols::Value>& args);
};
 
} // namespace Modules
 
#endif // CURLMODULE_CURLMODULE_HPP