本文整理汇总了C++中GetIndent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetIndent函数的具体用法?C++ GetIndent怎么用?C++ GetIndent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetIndent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetIndent
void WgResourceSerializerXML::WriteNode(std::stringstream& ss, const OutNode& node, int nDepth)
{
ss << GetIndent(nDepth) << "<" << node.xmlNode.GetName();
for(Uint32 iAttr = 0; iAttr < node.xmlNode.GetAttributeCount(); iAttr++)
{
std::string escaped;
WgUtil::XMLEscape(node.xmlNode.GetAttribute(iAttr).GetValue(), escaped);
ss << " " << node.xmlNode.GetAttribute(iAttr).GetName() << "=\"" << escaped << "\"";
}
if( node.children.size() || node.text.str().size() )
{
ss << ">" << node.text.str();
if(node.children.size())
{
ss << std::endl;
WriteNode(ss, *node.children[0], nDepth + 1);
for(Uint32 iChild = 1; iChild < node.children.size(); iChild++)
{
if(node.children[iChild - 1]->children.size() > 0 || node.children[iChild]->children.size() > 0)
ss << std::endl;
WriteNode(ss, *node.children[iChild], nDepth + 1);
}
}
ss << GetIndent(nDepth) << "</" << node.xmlNode.GetName() << ">" << std::endl;
}
else
{
ss << "/>" << std::endl;
}
}
示例2: GetIndent
void PrintVisitor::VisitSetOptsCmd(const SetOptsCmd* Cmd)
{
Out << GetIndent() << "(set-opts (";
IndentLevel++;
for(auto const& Opt : Cmd->GetOpts()) {
Out << endl << GetIndent() << "(" << Opt.first << " \"" << Opt.second << "\")";
}
Out << endl;
IndentLevel--;
Out << GetIndent() << "))" << endl << endl;
}
示例3: StartedNode
void EmitterState::StartedGroup(GroupType::value type) {
StartedNode();
const int lastGroupIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
m_curIndent += lastGroupIndent;
// TODO: Create move constructors for settings types to simplify transfer
std::unique_ptr<Group> pGroup(new Group(type));
// transfer settings (which last until this group is done)
//
// NB: if pGroup->modifiedSettings == m_modifiedSettings,
// m_modifiedSettings is not changed!
pGroup->modifiedSettings = std::move(m_modifiedSettings);
// set up group
if (GetFlowType(type) == Block) {
pGroup->flowType = FlowType::Block;
} else {
pGroup->flowType = FlowType::Flow;
}
pGroup->indent = GetIndent();
m_groups.push_back(std::move(pGroup));
}
示例4: GetIndent
void XsiExp::ExportNodeHeader( INode * node, TCHAR * type, int indentLevel)
{
TSTR indent = GetIndent(indentLevel);
// node header: object type and name
fprintf(pStream,"%s%s frm-%s {\n\n", indent.data(), type, FixupName(node->GetName()));
}
示例5: SpecialPresetTreeView
SpecialPresetTreeView(wxWindow* parent) :
wxDataViewTreeCtrl{ parent, -1 },
root_{ wxDataViewItem(nullptr) },
parent_dialog_{ nullptr }
{
// Computing the minimum width of the tree is slightly complicated, since
// wx doesn't expose it to us directly
wxClientDC dc(this);
dc.SetFont(GetFont());
wxSize textsize;
// Populate tree
addPresets(Game::customSpecialPresets(), textsize, dc); // User custom presets
addPresets(Game::configuration().specialPresets(), textsize, dc); // From game configuration
wxDataViewCtrl::Expand(root_);
// Bind events
Bind(wxEVT_DATAVIEW_ITEM_START_EDITING, [&](wxDataViewEvent& e) { e.Veto(); });
Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, [&](wxDataViewEvent& e)
{
if (GetChildCount(e.GetItem()) > 0)
{
// Expand if group node
Expand(e.GetItem());
e.Skip();
}
else if (parent_dialog_)
parent_dialog_->EndModal(wxID_OK);
});
// 64 is an arbitrary fudge factor -- should be at least the width of a
// scrollbar plus the expand icons plus any extra padding
int min_width = textsize.GetWidth() + GetIndent() + UI::scalePx(64);
wxWindowBase::SetMinSize(wxSize(min_width, UI::scalePx(200)));
}
示例6: cli_Begin
const cli::tk::String NativeTraces::Begin(const char* const STR_Method)
{
m_iJniStackSize ++;
cli::StringDevice cli_Begin(0, false);
cli_Begin << GetIndent() << ">> " << STR_Method;
return cli_Begin.GetString();
}
示例7: cli_End
const cli::tk::String NativeTraces::EndFloat(const char* const STR_Method, const double D_Value)
{
cli::StringDevice cli_End(0, false);
cli_End << GetIndent() << "<< " << STR_Method << " : " << D_Value;
m_iJniStackSize --;
return cli_End.GetString();
}
示例8: SelectItem
void CTreeFileCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
*pResult = 0;
SelectItem(pNMTreeView->itemNew.hItem);
if (!IsDropSource(pNMTreeView->itemNew.hItem) || !m_bAllowDragDrop)
return;
m_pilDrag = CreateDragImage(pNMTreeView->itemNew.hItem);
if (!m_pilDrag)
return;
m_hItemDrag = pNMTreeView->itemNew.hItem;
m_hItemDrop = NULL;
// Calculate the offset to the hotspot
CPoint offsetPt(8,8); // Initialize a default offset
CPoint dragPt = pNMTreeView->ptDrag; // Get the Drag point
UINT nHitFlags = 0;
HTREEITEM htiHit = HitTest(dragPt, &nHitFlags);
if (htiHit != NULL)
{
// The drag point has Hit an item in the tree
CRect itemRect;
if (GetItemRect(htiHit, &itemRect, FALSE))
{
// Count indent levels
HTREEITEM htiParent = htiHit;
int nIndentCnt = 0;
while (htiParent != NULL)
{
htiParent = GetParentItem(htiParent);
nIndentCnt++;
}
if (!(GetStyle() & TVS_LINESATROOT))
nIndentCnt--;
// Calculate the new offset
offsetPt.y = dragPt.y - itemRect.top;
offsetPt.x = dragPt.x - (nIndentCnt * GetIndent()) + GetScrollPos(SB_HORZ);
}
}
//Begin the dragging
m_pilDrag->BeginDrag(0, offsetPt);
POINT pt = pNMTreeView->ptDrag;
ClientToScreen(&pt);
m_pilDrag->DragEnter(NULL, pt);
SetCapture();
m_nTimerID = SetTimer(1, 300, NULL);
}
示例9: switch
BOOL XsiExp::nodeEnumBone( INode * node, int indentLevel)
{
if(exportSelected && node->Selected() == FALSE)
{
return TREE_CONTINUE;
}
nCurNode++;
ip->ProgressUpdate( (int)((float)nCurNode/nTotalNodeCount*100.0f) );
// Stop recursing if the user pressed Cancel
if (ip->GetCancel())
{
return FALSE;
}
// Only export if exporting everything or it's selected
if(!exportSelected || node->Selected())
{
// The ObjectState is a 'thing' that flows down the pipeline containing
// all information about the object. By calling EvalWorldState() we tell
// max to eveluate the object at end of the pipeline.
ObjectState os = node->EvalWorldState(0);
// The obj member of ObjectState is the actual object we will export.
if (os.obj)
{
// We look at the super class ID to determine the type of the object.
switch(os.obj->SuperClassID())
{
case HELPER_CLASS_ID:
ExportBoneObject(node, indentLevel);
break;
default:
return FALSE;
}
}
}
// For each child of this node, we recurse into ourselves
// until no more children are found.
for (int c = 0; c < node->NumberOfChildren(); c++)
{
if (!nodeEnumBone(node->GetChildNode(c), indentLevel+1))
{
return FALSE;
}
}
TSTR indent = GetIndent(indentLevel);
fprintf(pStream,"%s}\n\n", indent.data());
return TRUE;
}
示例10: GetIndent
BOOL AscOut::nodeEnum(INode* node, int indentLevel)
{
nCurNode++;
ip->ProgressUpdate((int)((float)nCurNode/nTotalNodeCount*100.0f));
// Stop recursing if the user pressed Cancel
if (ip->GetCancel())
return FALSE;
TSTR indent = GetIndent(indentLevel);
// Only export if exporting everything or it's selected
if(!exportSelected || node->Selected()) {
// The ObjectState is a 'thing' that flows down the pipeline containing
// all information about the object. By calling EvalWorldState() we tell
// max to eveluate the object at end of the pipeline.
ObjectState os = node->EvalWorldState(0);
// The obj member of ObjectState is the actual object we will export.
if (os.obj) {
// We look at the super class ID to determine the type of the object.
switch(os.obj->SuperClassID()) {
case GEOMOBJECT_CLASS_ID:
ExportGeomObject(node, indentLevel);
break;
case CAMERA_CLASS_ID:
ExportCameraObject(node, indentLevel);
break;
case LIGHT_CLASS_ID:
ExportLightObject(node, indentLevel);
break;
case SHAPE_CLASS_ID:
ExportShapeObject(node, indentLevel);
break;
case HELPER_CLASS_ID:
ExportHelperObject(node, indentLevel);
break;
}
}
}
// For each child of this node, we recurse into ourselves
// until no more children are found.
for (int c = 0; c < node->NumberOfChildren(); c++) {
if (!nodeEnum(node->GetChildNode(c), indentLevel))
return FALSE;
}
return TRUE;
}
示例11: cli_Trace
const cli::tk::String NativeTraces::Instance(const int I_NativeObjectRef, const int I_Tokens, const bool B_AutoDelete)
{
cli::StringDevice cli_Trace(0, false);
cli_Trace << GetIndent();
cli_Trace << "[object " << I_NativeObjectRef << "] ";
cli_Trace << "tokens = " << I_Tokens << ", ";
cli_Trace << "auto-delete: " << (B_AutoDelete ? "yes" : "no");
if ((I_Tokens <= 0) && (B_AutoDelete))
{
cli_Trace << " -> deletion";
}
return cli_Trace.GetString();
}
示例12: GetKeywordTable
int MgProperty::Save(IoDataStream *s, const char *keyword)
{
int valid, mask;
register int i;
const KeywordTable *ktab = GetKeywordTable();
valid = mValid;
#if PRINTPOINTERS
s->PrintF("%s%s { #### addr = 0x%08x [mRefCount=%3d]\n",
GetIndent(), keyword, this, RefCount());
#else
s->PrintF("%s%s {\n", GetIndent(), keyword);
#endif
for(i = 0; i < GetNumKeywords(); i++)
{
mask = ktab[i].mask;
if((valid & mask) == 0)
continue;
valid &= ~mask;
s->PrintF( "\t%s%c %c%s", GetIndent(),
(mOverride & mask) ? '*' : ' ',
((ktab[i].numargs == 0) && (mFlags&mask) == 0) ? '-' : ' ',
ktab[i].word );
if (ktab[i].numargs > 0)
s->PutC(' ');
if (!SaveProcess(s, mask)) return 0;
s->PutC('\n');
}
if (!SaveProcessMore(s)) return 0;
s->PrintF("%s}\n", GetIndent());
return 1;
}
示例13: pGroup
void EmitterState::BeginGroup(GROUP_TYPE type)
{
unsigned lastIndent = (m_groups.empty() ? 0 : m_groups.top()->indent);
m_curIndent += lastIndent;
std::unique_ptr <Group> pGroup(new Group(type));
// transfer settings (which last until this group is done)
pGroup->modifiedSettings = m_modifiedSettings;
// set up group
pGroup->flow = GetFlowType(type);
pGroup->indent = GetIndent();
pGroup->usingLongKey = (GetMapKeyFormat() == LongKey ? true : false);
m_groups.push(pGroup.release());
}
示例14: GetPadding
suic::Size TreeViewItem::MeasureOverride(const suic::Size& availableSize)
{
_expand->Measure(availableSize);
_check.Measure(availableSize);
suic::Size retSize;
if (!IsCollapsed())
{
retSize = __super::MeasureOverride(availableSize);
}
retSize.cy += GetPadding().top;
retSize.cy += GetPadding().bottom;
retSize.cx += GetIndent();
return retSize;
}
示例15: LineFromPosition
void PythonCodeCtrl::OnCharAdded(wxScintillaEvent& ke)
{
//User has pressed enter
//if the cursor is at the end of a completed statement, submit the statement to the interpreter
//otherwise, do auto-indentation
if (ke.GetKey() == _T('\n'))
{
//int pos = GetCurrentPos();
int line = LineFromPosition(GetCurrentPos());
if(line>0)
{
wxString prevlinetext = GetLine(line-1).Trim();
int indentation = GetLineIndentation(line-1);
if((indentation==0) //submit a return pressed on an unindented line
|| (indentation>0 && prevlinetext==wxEmptyString)) // or an indented block where the previous line was empty
{
long rs,re;
GetSelection(&rs,&re);
//if(rs==re && GetLastPosition()==rs)
if(rs==re && GetLength()==rs) // only submit if the cursor is at the end of the control (and there is no selection)
{
m_pyctrl->DispatchCode(GetValue());
ke.Skip();
}
}
// Otherwise indent the code if necessary
if (GetLine(line-1).Trim().EndsWith(_T(":")))
{
if(GetStyleAt(GetLineEndPosition(line-1)-1) == wxSCI_P_OPERATOR)
indentation+=GetIndent();
}
if (indentation>0)
{
SetLineIndentation(line,indentation);
SetCurrentPos(PositionFromLine(line)+indentation);
SetAnchor(PositionFromLine(line)+indentation);
}
}
}
ke.Skip();
}