1#include <stdio.h>
2#include <string.h>
3#include "source.hpp"
4#include "utf8/checked.h"
5#include "position.hpp"
6
7namespace Sass {
8
9 SourceData::SourceData()
10 : SharedObj()
11 {
12 }
13
14 SourceFile::SourceFile(
15 const char* path,
16 const char* data,
17 size_t srcid) :
18 SourceData(),
19 path(sass_copy_c_string(str: path)),
20 data(sass_copy_c_string(str: data)),
21 length(0),
22 srcid(srcid)
23 {
24 length = strlen(s: data);
25 }
26
27 SourceFile::~SourceFile() {
28 sass_free_memory(ptr: path);
29 sass_free_memory(ptr: data);
30 }
31
32 const char* SourceFile::end() const
33 {
34 return data + length;
35 }
36
37 const char* SourceFile::begin() const
38 {
39 return data;
40 }
41
42 const char* SourceFile::getRawData() const
43 {
44 return data;
45 }
46
47 SourceSpan SourceFile::getSourceSpan()
48 {
49 return SourceSpan(this);
50 }
51
52 ItplFile::ItplFile(const char* data, const SourceSpan& pstate) :
53 SourceFile(pstate.getPath(),
54 data, pstate.getSrcId()),
55 pstate(pstate)
56 {}
57
58 const char* ItplFile::getRawData() const
59 {
60 return pstate.getRawData();
61 }
62
63 SourceSpan ItplFile::getSourceSpan()
64 {
65 return SourceSpan(pstate);
66 }
67
68}
69
70

source code of gtk/subprojects/libsass/src/source.cpp