2 #ifndef EPT_DEBTAGS_PKGID_H
3 #define EPT_DEBTAGS_PKGID_H
28 #include <tagcoll/diskindex/mmap.h>
40 class PkgId :
public tagcoll::diskindex::MMap
42 tagcoll::diskindex::MasterMMap mastermmap;
47 PkgId(
const tagcoll::diskindex::MasterMMap& master,
size_t idx);
54 size_t size()
const {
return m_buf ? *(
int*)m_buf /
sizeof(
int) : 0; }
61 int byName(
const std::string& name)
const;
68 std::string
byID(
int id)
const
70 if (
id >= 0 || static_cast<unsigned>(
id) <
size())
71 return std::string(m_buf + ((
int*)m_buf)[
id]);
78 if (
id < 0 || (
unsigned)
id >=
size())
80 if ((
unsigned)
id ==
size() - 1)
81 return m_size - ((
int*)m_buf)[id] - 1;
83 return ((
int*)m_buf)[
id + 1] - ((
int*)m_buf)[
id] - 1;
-*- C++ -*- (c) 2006, 2007 Petr Rockai me@mornfall.net
Definition: apt.cc:43