Menu

[0b4401]: / PythonScript / src / ScintillaCells.cpp  Maximize  Restore  History

Download this file

36 lines (27 with data), 1.1 kB

 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
#include "stdafx.h"
#include "ScintillaCells.h"
//lint -e1732 (Info -- new in constructor for class 'ScintillaCells' which has no assignment operator -- Effective C++ #11)
//lint -e1733 (Info -- new in constructor for class 'ScintillaCells' which has no copy constructor -- Effective C++ #11)
// The allocated memory is placed inside a shared_ptr. The default copy constructor and assignment operator will do just fine.
ScintillaCells::ScintillaCells(boost::python::str characters, boost::python::list styles) :
m_length(_len(characters)),
m_cells(new unsigned char[m_length*2])
{
const char *chrs = boost::python::extract<const char*>(characters);
size_t styleLength = _len(styles);
int style = 0;
for(idx_t pos = 0; pos < m_length; pos++)
{
if (pos < styleLength)
{
style = boost::python::extract<int>(styles[pos]);
}
m_cells.get()[pos*2] = (unsigned char)chrs[pos];
m_cells.get()[(pos*2) + 1] = static_cast<unsigned char>(style);
}
}
//lint +e1732
//lint +e1733
ScintillaCells::~ScintillaCells()
{
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.