[DEV] add the basic File Object
This commit is contained in:
parent
697b2a743d
commit
9e2a9ed301
@ -35,6 +35,7 @@ list_of_known_type = [
|
||||
["file", "zeus::File"],
|
||||
["stream", "zeus::Stream"],
|
||||
["json", "ejson::Object"],
|
||||
["buffer", "zeus::Buffer"],
|
||||
]
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
import lutin.macro as macro
|
||||
|
||||
|
||||
def get_type():
|
||||
@ -41,7 +42,6 @@ def configure(target, my_module):
|
||||
'zeus/AbstractFunction.cpp',
|
||||
'zeus/FutureBase.cpp',
|
||||
'zeus/Future.cpp',
|
||||
'zeus/File.cpp',
|
||||
'zeus/Buffer.cpp',
|
||||
'zeus/BufferParameter.cpp',
|
||||
'zeus/BufferCall.cpp',
|
||||
@ -71,7 +71,6 @@ def configure(target, my_module):
|
||||
'zeus/FutureData.hpp',
|
||||
'zeus/FutureBase.hpp',
|
||||
'zeus/Future.hpp',
|
||||
'zeus/File.hpp',
|
||||
'zeus/Buffer.hpp',
|
||||
'zeus/BufferParameter.hpp',
|
||||
'zeus/BufferCall.hpp',
|
||||
@ -93,6 +92,11 @@ def configure(target, my_module):
|
||||
'zeus/RemoteProperty.hpp',
|
||||
'zeus/SystemProxy.hpp',
|
||||
])
|
||||
|
||||
# add basic object:
|
||||
zeus_macro = macro.load_macro('zeus')
|
||||
zeus_macro.parse_object_idl(my_module, 'zeus/zeus-File.obj.zeus.idl')
|
||||
|
||||
if target.config["compilator"] == "clang":
|
||||
my_module.add_flag('c++', "-Wno-unsequenced", export=True)
|
||||
# build in C++ mode
|
||||
|
@ -93,7 +93,7 @@ zeus::ParamType zeus::BufferParameter::getParameterType(int32_t _id) const {
|
||||
if (typeId == createType<std::vector<uint16_t>>().getId()) { m_parameter[_id].first = 2; return createType<std::vector<uint16_t>>(); }
|
||||
if (typeId == createType<std::vector<uint8_t>>().getId()) { m_parameter[_id].first = 2; return createType<std::vector<uint8_t>>(); }
|
||||
if (typeId == createType<std::vector<std::string>>().getId()) { m_parameter[_id].first = 2; return createType<std::vector<std::string>>(); }
|
||||
if (typeId == createType<zeus::File>().getId()) { m_parameter[_id].first = 2; return createType<zeus::File>(); }
|
||||
//if (typeId == createType<zeus::File>().getId()) { m_parameter[_id].first = 2; return createType<zeus::File>(); }
|
||||
if (typeId == paramTypeRaw) {
|
||||
m_parameter[_id].first = sizeof(uint16_t);
|
||||
return zeus::ParamType("raw", paramTypeRaw);
|
||||
|
@ -307,7 +307,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
#define ZEUS_MINIMUM_SIZE_MULTIPLE (1024*50)
|
||||
|
||||
#if 0
|
||||
class SendData {
|
||||
private:
|
||||
std::vector<uint8_t> m_data;
|
||||
@ -446,5 +446,6 @@ namespace zeus {
|
||||
m_multipleSend.push_back(zeus::SendFile(_value.getFileName(), _paramId, size));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ namespace zeus {
|
||||
ZEUS_ERROR("Can not get type from '" << type << "'");
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
template<>
|
||||
zeus::File BufferParameter::getParameter<zeus::File>(int32_t _id) const {
|
||||
zeus::File out;
|
||||
@ -1470,6 +1470,7 @@ namespace zeus {
|
||||
ZEUS_ERROR("Can not get type from '" << type << "'");
|
||||
return out;
|
||||
}
|
||||
*/
|
||||
template<>
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> BufferParameter::getParameter<ememory::SharedPtr<zeus::ObjectRemoteBase>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> out;
|
||||
|
@ -128,8 +128,10 @@ generate_basic_type(std::vector<uint16_t>, "vector:uint16", 0x010B, true, true);
|
||||
generate_basic_type(std::vector<uint8_t>, "vector:uint8", 0x010C, true, true);
|
||||
generate_basic_type(std::vector<std::string>, "vector:string", 0x010D, false, true);
|
||||
|
||||
#if 0
|
||||
generate_basic_type(zeus::File, "file", 0x000E, false, false);
|
||||
generate_basic_type(zeus::FileServer, "file", 0x000E, false, false);
|
||||
#endif
|
||||
|
||||
const uint16_t zeus::paramTypeObject = 0xFFFF;
|
||||
const uint16_t zeus::paramTypeRaw = 0xFFFE;
|
||||
|
20
zeus/zeus-File.obj.zeus.idl
Normal file
20
zeus/zeus-File.obj.zeus.idl
Normal file
@ -0,0 +1,20 @@
|
||||
#elem-brief: File Object interface
|
||||
#elem-version: 1.0
|
||||
#elem-type:FILE
|
||||
#elem-author:Heero Yui<yui.heero@gmail.com>
|
||||
|
||||
#brief:Get size of the file
|
||||
#return:current size of the file
|
||||
uint64 size()
|
||||
|
||||
#brief:Get the name of the file
|
||||
#return:Full name of the file (sha512)
|
||||
string name()
|
||||
|
||||
#brief:Get the file "mine-type"
|
||||
#return:string of the mine-type
|
||||
string getMineType()
|
||||
|
||||
#brief:get a part of the file (size < 64ko)
|
||||
#return:Buffer with the data
|
||||
buffer getPart(uint64, uint64)
|
@ -3,6 +3,7 @@
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#if 0
|
||||
#include <zeus/File.hpp>
|
||||
#include <zeus/debug.hpp>
|
||||
#include <etk/types.hpp>
|
||||
@ -12,7 +13,6 @@
|
||||
#include <cstring>
|
||||
|
||||
|
||||
|
||||
zeus::File::File() {
|
||||
|
||||
}
|
||||
@ -74,4 +74,5 @@ namespace etk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,8 @@
|
||||
#pragma once
|
||||
#include <etk/types.hpp>
|
||||
|
||||
|
||||
#if 0
|
||||
namespace zeus {
|
||||
/**
|
||||
* @brief File inetrface
|
||||
@ -119,3 +121,5 @@ namespace zeus {
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user