Пример #1
0
CRef<CBioseq> MakeMaskingBioseq(const CSeq_id& new_id,
                                TSeqPos seq_length,
                                const CSeq_id& original_id,
                                const CSeq_loc& masking_loc)
{
    return MakeMaskingBioseq(new_id, seq_length,
                             ConstRef(&original_id), masking_loc);
}
Пример #2
0
CSeqMap_CI::CSeqMap_CI(const CBioseq_Handle& bioseq,
                       const SSeqMapSelector& sel,
                       TSeqPos pos)
    : m_Scope(&bioseq.GetScope()),
      m_SearchPos(0),
      m_SearchEnd(kInvalidSeqPos)
{
    SSeqMapSelector tse_sel(sel);
    tse_sel.SetLinkUsedTSE(bioseq.GetTSE_Handle());
    x_Select(ConstRef(&bioseq.GetSeqMap()), tse_sel, pos);
}
Пример #3
0
CSeqMap_CI::CSeqMap_CI(const CBioseq_Handle& bioseq,
                       const SSeqMapSelector& sel,
                       const CRange<TSeqPos>& range)
    : m_Scope(&bioseq.GetScope()),
      m_SearchPos(range.GetFrom()),
      m_SearchEnd(range.GetToOpen())
{
    SSeqMapSelector tse_sel(sel);
    tse_sel.SetLinkUsedTSE(bioseq.GetTSE_Handle());
    x_Select(ConstRef(&bioseq.GetSeqMap()), tse_sel, range.GetFrom());
}
Пример #4
0
CConstRef<CSeq_interval> CSeqTable_column::GetSeq_int(size_t row) const
{
    size_t index = row;
    if ( IsSetSparse() ) {
        index = GetSparse().GetIndexAt(row);
        if ( index == CSeqTable_sparse_index::kSkipped ) {
            if ( IsSetSparse_other() ) {
                return ConstRef(&GetSparse_other().GetInterval());
            }
            return null;
        }
    }
    if ( IsSetData() ) {
        const CSeqTable_multi_data::TInterval& arr = GetData().GetInterval();
        if ( index < arr.size() ) {
            return arr[index];
        }
    }
    if ( IsSetDefault() ) {
        return ConstRef(&GetDefault().GetInterval());
    }
    return null;
}
Пример #5
0
int Foo (Packed &p, int i, int ui)
{
  int r;
  
  if ((r = Val (p.i, i)))
    return r;
  if ((r = Val (p.u.i, ui)))
    return r + 2;
  if ((r = Val (p.u, ui)))
    return r + 4;
  
  if ((r = ConstRef (p.i, &p.i, i)))
    return r + 6;

  return 0;
}
Пример #6
0
void CSeqTableLocColumns::AddExtraColumn(const CSeqTable_column& column,
                                         const CSeqTableSetLocField* setter)
{
    m_ExtraColumns.push_back(TColumnInfo(column, ConstRef(setter)));
    m_Is_set = true;
}
Пример #7
0
        {
			dword tlen = s_strlen(lptstr, INT_MAX);
			tmp.SetSize(__FILE__LINE__ tlen + 1);
			s_strcpy(CastMutable(CPointer, tmp.GetString()), tlen + 1, lptstr);
            GlobalUnlock(hglb); 
        } 
    } 
    CloseClipboard();
#endif
#ifdef OK_SYS_UNIX
	tmp = _clipboardtext;
#endif
	return tmp;
 }

bool CConsoleClipboard::SetClipboardText(ConstRef(CStringBuffer) text)
{
#ifdef OK_SYS_WINDOWS
	HWND hwnd = GetConsoleWindow();
	HGLOBAL hglbCopy;
	LPTSTR  lptstrCopy;

	if ( !hwnd )
		return false;
	if ( !OpenClipboard(hwnd) ) 
		return false;
	EmptyClipboard();
	hglbCopy = GlobalAlloc(GMEM_MOVEABLE, text.GetSize() * sizeof(TCHAR));
	if ( !hglbCopy )
	{
		CloseClipboard();
Пример #8
0
std::string SymbolicVal::toString() const
{ 
   return (ConstPtr() != 0)? ConstRef().toString() : std::string("");
}
Пример #9
0
}

CListView::CListView(LPCTSTR name):
	CControl(name),
	m_SelectMode(TSelectModeDisabled),
	m_editable(false),
	m_hasSelection(false),
	m_nodes(__FILE__LINE__ 64, 128),
	m_selNodes(__FILE__LINE__ 64, 128),
	m_images(),
	m_currentNode(NULL),
	m_editor(NULL)
{
}

CListView::CListView(ConstRef(CStringBuffer) name):
	CControl(name),
	m_SelectMode(TSelectModeDisabled),
	m_editable(false),
	m_hasSelection(false),
	m_nodes(__FILE__LINE__ 64, 128),
	m_selNodes(__FILE__LINE__ 64, 128),
	m_images(),
	m_currentNode(NULL),
	m_editor(NULL)
{
}

CListView::~CListView(void)
{
	clear();
Пример #10
0
CConstRef<CSeq_align> CSeq_align_Handle::GetSeq_align(void) const
{
    return ConstRef(&x_GetSeq_align());
}
Пример #11
0
bool CSeqMap_CI::x_Push(TSeqPos pos, bool resolveExternal)
{
    const TSegmentInfo& info = x_GetSegmentInfo();
    if ( !info.InRange() ) {
        return false;
    }
    const CSeqMap::CSegment& seg = info.x_GetSegment();
    CSeqMap::ESegmentType type = CSeqMap::ESegmentType(seg.m_SegType);

    switch ( type ) {
    case CSeqMap::eSeqSubMap:
    {{
        CConstRef<CSeqMap> push_map
            (static_cast<const CSeqMap*>(info.m_SeqMap->x_GetObject(seg)));
        // We have to copy the info.m_TSE into local variable push_tse because
        // of TSegmentInfo referenced by info can be moved inside x_Push() call.
        CTSE_Handle push_tse = info.m_TSE;
        x_Push(push_map, info.m_TSE,
               GetRefPosition(), GetLength(), GetRefMinusStrand(), pos);
        break;
    }}
    case CSeqMap::eSeqRef:
    {{
        if ( !resolveExternal ) {
            return false;
        }
        const CSeq_id& seq_id =
            static_cast<const CSeq_id&>(*info.m_SeqMap->x_GetObject(seg));
        CBioseq_Handle bh;
        if ( m_Selector.x_HasLimitTSE() ) {
            // Check TSE limit
            bh = m_Selector.x_GetLimitTSE().GetBioseqHandle(seq_id);
            if ( !bh ) {
                return false;
            }
        }
        else {
            if ( !GetScope() ) {
                NCBI_THROW(CSeqMapException, eNullPointer,
                           "Cannot resolve "+
                           seq_id.AsFastaString()+": null scope pointer");
            }
            bh = GetScope()->GetBioseqHandle(seq_id);
            if ( !bh ) {
                if ( GetFlags() & CSeqMap::fIgnoreUnresolved ) {
                    return false;
                }
                NCBI_THROW(CSeqMapException, eFail,
                           "Cannot resolve "+
                           seq_id.AsFastaString()+": unknown");
            }
        }
        if ( (GetFlags() & CSeqMap::fByFeaturePolicy) &&
            bh.GetFeatureFetchPolicy() == bh.eFeatureFetchPolicy_only_near ) {
            return false;
        }
        if ( info.m_TSE ) {
            if ( !info.m_TSE.AddUsedTSE(bh.GetTSE_Handle()) ) {
                m_Selector.AddUsedTSE(bh.GetTSE_Handle());
            }
        }
        size_t depth = m_Stack.size();
        x_Push(ConstRef(&bh.GetSeqMap()), bh.GetTSE_Handle(),
               GetRefPosition(), GetLength(), GetRefMinusStrand(), pos);
        if (m_Stack.size() == depth) {
            return false;
        }
        m_Selector.PushResolve();
        if ( (m_Stack.size() & 63) == 0 ) {
            // check for self-recursion every 64'th stack frame
            const CSeqMap* top_seq_map = &m_Stack.back().x_GetSeqMap();
            for ( int i = m_Stack.size()-2; i >= 0; --i ) {
                if ( &m_Stack[i].x_GetSeqMap() == top_seq_map ) {
                    NCBI_THROW(CSeqMapException, eSelfReference,
                               "Self-reference in CSeqMap");
                }
            }
        }
        break;
    }}
    default:
        return false;
    }
    return true;
}
Пример #12
0
			CConstPointer vName = va_arg(argList, CConstPointer);
			Ptr(CSqLite3Column) pColumn = OK_NEW_OPERATOR CSqLite3Column(vName, vDataType);

			_pFuncInfo->Append(pColumn);
		}
		va_end(argList);

		_lpImpl->create_function(_pFuncInfo);
	}
}

CSqLite3Connection::create_function_infoclass::create_function_infoclass(Ptr(CSqLite3Connection) pConn, CConstPointer name, create_function_type funcbody, sword nArgs) :
_pConn(pConn), _name(__FILE__LINE__ name), _func(funcbody), _nArgs(nArgs), _args(__FILE__LINE__ 16, 16, CSqLite3ColumnsDeleteFunc)
{}

CSqLite3Connection::create_function_infoclass::create_function_infoclass(Ptr(CSqLite3Connection) pConn, ConstRef(CStringBuffer) name, create_function_type funcbody, sword nArgs) :
_pConn(pConn), _name(name), _func(funcbody), _nArgs(nArgs), _args(__FILE__LINE__ 16, 16, CSqLite3ColumnsDeleteFunc)
{}

CSqLite3Connection::create_function_infoclass::~create_function_infoclass() {}

void CSqLite3Connection::create_function_infoclass::Append(Ptr(CSqLite3Column) pArg)
{
	_args.Append(pArg);
}

CSqLite3Statement::CSqLite3Statement(CSqLite3Environment* lpEnv, CSqLite3StatementImpl* lpStmtImpl) :
_lpEnv(lpEnv), _lpImpl(lpStmtImpl), _columns(__FILE__LINE__ 16, 16, CSqLite3ColumnsDeleteFunc)
{
	if (_lpEnv)
		_lpEnv->addRef();
Пример #13
0
#endif
{
	SetString(ARGS_FILE_LINE _str.GetCurrent(), _str.GetLength());
}

CStringBuffer::CStringBuffer(DECL_FILE_LINE CStringLiteral _str):
    CStringLiteral()
#ifdef __DEBUG__
	, _file(file), _line(line)
#endif
{
	SetString(ARGS_FILE_LINE _str.GetString(), _str.GetLength());
}

#ifdef QT_VERSION
CStringBuffer::CStringBuffer( ConstRef(QString) _str):
    CStringLiteral()
#ifdef __DEBUG__
, _file(NULL), _line(0)
#endif
{
    SetString(_str);
}
#endif

CStringBuffer::CStringBuffer(const CStringBuffer& copy):
    CStringLiteral()
#ifdef __DEBUG__
	, _file(copy._file), _line(copy._line)
#endif
{
Пример #14
0
#ifdef OK_SYS_WINDOWS
#include <winsock2.h>
#ifdef OK_COMP_MSC
#pragma comment (lib, "Ws2_32.lib")
#endif
#endif
#ifdef OK_SYS_UNIX
#include <netdb.h>
#endif

CWinException::CWinException():
	CBaseException()
{
}

CWinException::CWinException(DECL_FILE_LINE ConstRef(CStringLiteral) format) :
CBaseException(ARGS_FILE_LINE format)
{
}

CWinException::CWinException(DECL_FILE_LINE ConstRef(CStringLiteral) format, CConstPointer sArg) :
CBaseException(ARGS_FILE_LINE format, sArg)
{
}

CWinException::CWinException(DECL_FILE_LINE ConstRef(CStringLiteral) format, CConstPointer sArg1, CConstPointer sArg2) :
CBaseException(ARGS_FILE_LINE format, sArg1, sArg2)
{
}

CWinException::CWinException(DECL_FILE_LINE ConstRef(CStringLiteral) format, int sArg) :
Пример #15
0
******************************************************************************/
#include "WS_PCH.H"
#include "AsyncFile.h"
#include "SecurityFile.h"
#include "WinDirectoryIterator.h"

CAsyncFile::CAsyncFile(Ptr(CAsyncIOManager) pManager):
    CAsyncIOBuffer(pManager)
{
}

CAsyncFile::~CAsyncFile(void)
{
}

void CAsyncFile::Create(ConstRef(CFilePath) _path)
{
	CWinDirectoryIterator::UnlinkFile(_path);

	SECURITY_ATTRIBUTES sa;
	HANDLE fHandle;

	sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	sa.lpSecurityDescriptor = NULL;
	sa.bInheritHandle = TRUE;

	fHandle = CreateFile(
		_path.get_Path().GetString(), // LPCTSTR lpFileName,
		GENERIC_READ | GENERIC_WRITE, // DWORD dwDesiredAccess,
		FILE_SHARE_READ, // DWORD dwShareMode,
		&sa, // LPSECURITY_ATTRIBUTES lpSecurityAttributes,