~ubuntu-branches/ubuntu/vivid/notecase/vivid

« back to all changes in this revision

Viewing changes to src/lib/LinkInfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Vijay(Vijay)
  • Date: 2007-06-14 00:13:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070614001348-z9e2vbgtenb9nhoo
Tags: 1.5.6-0ubuntu1
* New Upstream release 
*  The libgnomevfs2-dev is also added to Build-Depends 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////
 
2
// NoteCase notes manager project <http://notecase.sf.net>
 
3
//
 
4
// This code is licensed under BSD license.See "license.txt" for more details.
 
5
//
 
6
// File: Stores info for the single hyperlink
 
7
////////////////////////////////////////////////////////////////////////////
 
8
 
 
9
#ifndef LINKINFO_H_
 
10
#define LINKINFO_H_
 
11
 
 
12
#if _MSC_VER > 1000
 
13
#pragma once
 
14
#endif // _MSC_VER > 1000
 
15
 
 
16
#if _MSC_VER > 1000
 
17
  #pragma warning(disable:4786)
 
18
#endif
 
19
 
 
20
#include <string>
 
21
#include <vector>
 
22
 
 
23
class LinkInfo
 
24
{
 
25
public:
 
26
        LinkInfo();
 
27
        LinkInfo(const LinkInfo &other);
 
28
        virtual ~LinkInfo();
 
29
 
 
30
        bool IsValid();
 
31
        void Clear();
 
32
 
 
33
        void operator = (const LinkInfo &other);
 
34
        void RefreshLength();
 
35
 
 
36
        std::string m_strText;
 
37
        std::string m_strTargetURL;
 
38
        int                     m_nTargetNodeID;
 
39
        
 
40
        //position/size in utf8 character (NOT buffer offset)
 
41
        int  m_nStartOffset;
 
42
        int  m_nTextLength;
 
43
};
 
44
 
 
45
class LinkInfoList : public std::vector<LinkInfo>
 
46
{
 
47
public:
 
48
        LinkInfoList();
 
49
        virtual ~LinkInfoList();
 
50
        
 
51
        void Sort();
 
52
 
 
53
        int  Find(int nCharOffset);
 
54
        bool IsRangeOccupied(int nCharOffset, int nLen);        //any link in the range
 
55
        
 
56
        //API to work with ranges
 
57
        static bool RangesOverlap(int nA, int nB, int nC, int nD);
 
58
 
 
59
        //adapt to events within the node text buffer
 
60
        void OnTxtInsert(int nOffset, int nCharsAdded, const char *szTxt);
 
61
        void OnTxtReplaced(int nStart, int nEnd, const char *szTxt);
 
62
        void OnTxtDelete(int nOffset, int nCharsDeleted);
 
63
        void OnLinkCreated(int nOffset, int nLen);
 
64
};
 
65
 
 
66
#endif // LINKINFO_H_