<commit_before>#include "stdafx.h"
#include "../NFrameBase.h"

#include "../NRenderClip.h"
#include "UiUtil.h"

namespace nui
{
    namespace Ui
    {
        bool NFrameBase::IsVertLayout(UINT layout)
        {
            return (layout & NFrameBase::LayoutTop)
                || (layout & NFrameBase::LayoutBottom)
                || (layout & NFrameBase::LayoutVCenter)
                || (layout & NFrameBase::LayoutVFill);
        }

        bool NFrameBase::IsHorzLayout(UINT layout)
        {
            return (layout & NFrameBase::LayoutLeft)
                || (layout & NFrameBase::LayoutRight)
                || (layout & NFrameBase::LayoutHCenter)
                || (layout & NFrameBase::LayoutHFill);
        }

        NFrameBase::NFrameBase()
        {
            parentFrame_ = NULL;
            topMostCount_ = 0;
            bottomMostCount_ = 0;
            frameFlags_ = FlagVisible | FlagAutoSize | FlagLayoutable | FlagValid;
            frameStatus_ = StatusNormal;
            layout_ = LayoutNone;
            frameData_ = 0;
        }

        NFrameBase::~NFrameBase()
        {
            NAssertError(Util::Misc::IsFlagChecked(frameFlags_, FlagValid), _T("NFrameBase not valid already"));
            frameFlags_ = 0;
            parentFrame_ = NULL;
            RemoveAllChilds();
        }

        bool NFrameBase::AddChild(NFrameBase* child)
        {
            NAssertError(child != NULL, _T("wrong type"));
            if(child == NULL)
                return FALSE;

            // check if exists
            size_t zorder;
            UNREFERENCED_PARAMETER(zorder);
            NAssertError(GetChildHelper(child, zorder) == childs_.end(), _T("child already exists"));

            childs_.push_back(child);
            SetParentHelper(child, this);

            return true;
        }

        bool NFrameBase::RemoveChild(NFrameBase* child)
        {
            NAssertError(child != NULL, _T("wrong type"));
            if(child == NULL)
                return FALSE;

            size_t zorder;
            FrameList::const_iterator ite = GetChildHelper(child, zorder);<commit_msg>fix top most error: new childs show above topmost items<commit_after>#include "stdafx.h"
#include "../NFrameBase.h"

#include "../NRenderClip.h"
#include "UiUtil.h"

namespace nui
{
    namespace Ui
    {
        bool NFrameBase::IsVertLayout(UINT layout)
        {
            return (layout & NFrameBase::LayoutTop)
                || (layout & NFrameBase::LayoutBottom)
                || (layout & NFrameBase::LayoutVCenter)
                || (layout & NFrameBase::LayoutVFill);
        }

        bool NFrameBase::IsHorzLayout(UINT layout)
        {
            return (layout & NFrameBase::LayoutLeft)
                || (layout & NFrameBase::LayoutRight)
                || (layout & NFrameBase::LayoutHCenter)
                || (layout & NFrameBase::LayoutHFill);
        }

        NFrameBase::NFrameBase()
        {
            parentFrame_ = NULL;
            topMostCount_ = 0;
            bottomMostCount_ = 0;
            frameFlags_ = FlagVisible | FlagAutoSize | FlagLayoutable | FlagValid;
            frameStatus_ = StatusNormal;
            layout_ = LayoutNone;
            frameData_ = 0;
        }

        NFrameBase::~NFrameBase()
        {
            NAssertError(Util::Misc::IsFlagChecked(frameFlags_, FlagValid), _T("NFrameBase not valid already"));
            frameFlags_ = 0;
            parentFrame_ = NULL;
            RemoveAllChilds();
        }

        bool NFrameBase::AddChild(NFrameBase* child)
        {
            NAssertError(child != NULL, _T("wrong type"));
            if(child == NULL)
                return FALSE;

            // check if exists
            size_t zorder;
            NAssertError(GetChildHelper(child, zorder) == childs_.end(), _T("child already exists"));

            FrameList::const_iterator ite = GetChildHelper(child, zorder);
            for(int i=topMostCount_; i>0; --i)
            {
                -- ite;
            }
            childs_.insert(ite, child);
            SetParentHelper(child, this);

            return true;
        }

        bool NFrameBase::RemoveChild(NFrameBase* child)
        {
            NAssertError(child != NULL, _T("wrong type"));
            if(child == NULL)
                return FALSE;

            size_t zorder;
            FrameList::const_iterator ite = GetChildHelper(child, zorder);
{'fraction_non_alphanumeric': 0.1064835659612787, 'fraction_numerical': 0.002026114362899595, 'mean_word_length': 1.7613424487259166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '911645', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1213, 'n_words': 239}