• R/O
  • SSH

YSLib: Commit

The YSLib project - main repository


Commit MetaInfo

Revision26b75853b16af6c78dd7a42d561f912417fb1936 (tree)
Time2013-04-24 19:40:44
AuthorFrankHB <frankhb1989@gmai...>
CommiterFrankHB

Log Message

更新主分支版本: build 400 rev 32 。

Change Summary

Incremental Difference

diff -r 17b7acdaf1f3 -r 26b75853b16a Doxyfile
--- a/Doxyfile Sat Apr 20 10:58:52 2013 +0800
+++ b/Doxyfile Wed Apr 24 18:40:44 2013 +0800
@@ -32,7 +32,7 @@
3232 # This could be handy for archiving the generated documentation or
3333 # if some version control system is used.
3434
35-PROJECT_NUMBER = PreAlpha_b371_20130102
35+PROJECT_NUMBER = PreAlpha_b400_20130424
3636
3737 # Using the PROJECT_BRIEF tag one can provide an optional one line description
3838 # for a project that appears at the top of each page and should give viewer
diff -r 17b7acdaf1f3 -r 26b75853b16a YBase/include/ystdex/any_iterator.hpp
--- a/YBase/include/ystdex/any_iterator.hpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YBase/include/ystdex/any_iterator.hpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file any_iterator.hpp
1212 \ingroup YStandardEx
1313 \brief 动态泛型迭代器。
14-\version r588
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r811
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since build 355
1717 \par 创建时间:
1818 2012-11-08 14:28:42 +0800
1919 \par 修改时间:
20- 2013-01-22 08:02 +0800
20+ 2013-04-22 13:03 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,13 +25,12 @@
2525 */
2626
2727
28-#ifndef YB_INC_YSTDEX_ANY_ITERATOR_HPP_
29-#define YB_INC_YSTDEX_ANY_ITERATOR_HPP_ 1
28+#ifndef YB_INC_ystdex_any_iterator_hpp_
29+#define YB_INC_ystdex_any_iterator_hpp_ 1
3030
3131 #include "any.h"
3232 #include "cast.hpp" // for ystdex::polymorphic_downcast;
33-#include "memory.hpp" // for ystdex::is_dereferencable,
34-// ystdex::is_undereferencable;
33+#include "memory.hpp" // for ystdex::is_undereferenceable;
3534
3635 namespace ystdex
3736 {
@@ -43,8 +42,8 @@
4342 //@{
4443 enum iterator_op : op_code
4544 {
46- check_dereferencable = end_base_op,
47- check_undereferencable,
45+ //! \since build 400
46+ check_undereferenceable = end_base_op,
4847 dereference,
4948 increase,
5049 end_iterator_op
@@ -101,11 +100,8 @@
101100 {
102101 switch(op)
103102 {
104- case check_dereferencable:
105- d.access<bool>() = is_dereferencable(get_reference(s));
106- break;
107- case check_undereferencable:
108- d.access<bool>() = is_undereferencable(get_reference(s));
103+ case check_undereferenceable:
104+ d.access<bool>() = is_undereferenceable(get_reference(s));
109105 break;
110106 case dereference:
111107 d = void_ref(*get_reference(s));
@@ -150,26 +146,96 @@
150146 };
151147 //@}
152148
149+
150+//! \since build 400
151+template<typename _type>
152+class forward_iterator_handler : public input_iterator_handler<_type>
153+{
154+public:
155+ typedef input_iterator_handler<_type> base;
156+ typedef typename base::value_type value_type;
157+
158+ using base::get_reference;
159+
160+ using base::init;
161+
162+ using base::manage;
163+};
164+
165+
166+//! \since build 400
167+template<typename _type>
168+class bidirectional_iterator_handler : public forward_iterator_handler<_type>
169+{
170+public:
171+ typedef forward_iterator_handler<_type> base;
172+ typedef typename base::value_type value_type;
173+
174+ using base::get_reference;
175+
176+ using base::init;
177+
178+ static void
179+ manage(any_storage& d, const any_storage& s, any_ops::op_code op)
180+ {
181+ switch(op)
182+ {
183+ case decrease:
184+ --get_reference(d);
185+ break;
186+ default:
187+ base::manage(d, s, op);
188+ }
189+ }
190+};
191+
153192 } // namespace any_ops;
154193
155194
195+//! \since build 400
196+//@{
197+
198+#define YB_ITERATOR_OP1(_n, _t, _it, _e) \
199+ template<typename _type, typename _tDifference, typename _tPointer, \
200+ typename _tReference> \
201+ inline _t \
202+ _n(const _it<_type, _tDifference, _tPointer, _tReference>& i) \
203+ { \
204+ return _e; \
205+ }
206+
207+#define YB_ITERATOR_OP2(_n, _t, _it, _e) \
208+ template<typename _type, typename _tDifference, typename _tPointer, \
209+ typename _tReference> \
210+ inline _t \
211+ _n(const _it<_type, _tDifference, _tPointer, _tReference>& x, \
212+ const _it<_type, _tDifference, _tPointer, _tReference>& y) \
213+ { \
214+ return _e; \
215+ }
216+
217+#define YB_ITERATOR_MEMBER_POSTFIX(_op, _it) \
218+ _it \
219+ operator _op(int) \
220+ { \
221+ auto tmp = *this; \
222+ \
223+ _op *this; \
224+ return tmp; \
225+ }
226+
227+
156228 /*!
157229 \ingroup iterator_adaptors
158230 \brief 动态泛型输入迭代器。
159-\since 347
160231 */
161-template<typename _type, typename _tPointer = _type*,
162- typename _tReference = _type&>
163-class any_input_iterator : private std::iterator<std::input_iterator_tag, _type,
164- ptrdiff_t, _tPointer, _tReference>, protected any
232+template<typename _type, typename _tDifference = ptrdiff_t,
233+ typename _tPointer = _type*, typename _tReference = _type&>
234+class any_input_iterator : public std::iterator<std::input_iterator_tag, _type,
235+ _tDifference, _tPointer, _tReference>, protected any
165236 {
166237 public:
167- typedef std::iterator<std::input_iterator_tag, _type,
168- ptrdiff_t, _tPointer, _tReference> iterator_type;
169- //! \since build 349
170- typedef std::iterator_traits<iterator_type> traits_type;
171- typedef typename traits_type::value_type value_type;
172- typedef typename traits_type::pointer pointer;
238+ typedef _tPointer pointer;
173239 typedef _tReference reference;
174240
175241 //! \since build 357
@@ -230,34 +296,22 @@
230296 return static_cast<const any&>(*this);
231297 }
232298
233- //! \since build 355
234- //@{
299+ //! \since build 400
235300 bool
236- check_dereferencable() const
301+ check_undereferenceable() const
237302 {
238303 if(manager)
239304 {
240305 any_ops::any_storage t;
241306
242- manager(t, storage, any_ops::check_dereferencable);
243- return t.access<bool>();
244- }
245- return false;
246- }
247-
248- bool
249- check_undereferencable() const
250- {
251- if(manager)
252- {
253- any_ops::any_storage t;
254-
255- manager(t, storage, any_ops::check_undereferencable);
307+ manager(t, storage, any_ops::check_undereferenceable);
256308 return t.access<bool>();
257309 }
258310 return true;
259311 }
260312
313+ //! \since build 355
314+ //@{
261315 bool
262316 equals(const any_input_iterator& i) const
263317 {
@@ -271,60 +325,122 @@
271325 manager(t, i.storage, any_ops::equals);
272326 return t.access<bool>();
273327 }
274- //@}
275328
276- //! \since build 355
277329 using any::type;
330+ //@}
278331 };
279332
280-/*!
281-\brief 比较单态输入迭代器的相等性。
282-\param x 左操作数。
283-\param y 右操作数。
284-\pre 断言检查 <tt>x.get_holder().type() == y.get_holder().type()</tt> 。
285-\since build 347
286-*/
287-template<typename _type, typename _tPointer, typename _tReference>
288-inline bool
289-operator==(const any_input_iterator<_type, _tPointer, _tReference>& x,
290- const any_input_iterator<_type, _tPointer, _tReference>& y)
291-{
292- return x.equals(y);
293-}
333+YB_ITERATOR_OP2(operator==, bool, any_input_iterator, x.equals(y))
334+
335+YB_ITERATOR_OP2(operator!=, bool, any_input_iterator, !(x == y))
336+
337+YB_ITERATOR_OP1(is_undereferenceable, bool, any_input_iterator,
338+ i.check_undereferenceable())
339+
340+typedef any_input_iterator<void_ref, ptrdiff_t, void*, void_ref>
341+ input_monomorphic_iterator;
342+//@}
343+
294344
295345 /*!
296-\brief 比较单态输入迭代器的不等性。
297-\since build 347
346+\ingroup iterator_adaptors
347+\brief 动态泛型前向迭代器。
298348 */
299-template<typename _type, typename _tPointer, typename _tReference>
300-inline bool
301-operator!=(const any_input_iterator<_type, _tPointer, _tReference>& x,
302- const any_input_iterator<_type, _tPointer, _tReference>& y)
349+template<typename _type, typename _tDifference = ptrdiff_t,
350+ typename _tPointer = _type*, typename _tReference = _type&>
351+class any_forward_iterator
352+ : public any_input_iterator<_type, _tDifference, _tPointer, _tReference>
303353 {
304- return !(x == y);
305-}
354+public:
355+ typedef std::forward_iterator_tag iterator_category;
356+ typedef _tPointer pointer;
357+ typedef _tReference reference;
306358
307-//! \since build 347
308-template<typename _type, typename _tPointer, typename _tReference>
309-inline bool
310-is_dereferencable(const
311- any_input_iterator<_type, _tPointer, _tReference>& i)
312-{
313- return i.check_dereferencable();
314-}
359+ any_forward_iterator() = default;
360+ template<typename _tIterator>
361+ any_forward_iterator(_tIterator&& i)
362+ : any_input_iterator<_type, _tPointer, _tReference>(yforward(i))
363+ {}
364+ any_forward_iterator(const any_forward_iterator&) = default;
365+ any_forward_iterator(any_forward_iterator&&) = default;
315366
316-//! \since build 347
317-template<typename _type, typename _tPointer, typename _tReference>
318-inline bool
319-is_undereferencable(const
320- any_input_iterator<_type, _tPointer, _tReference>& i)
367+ any_forward_iterator&
368+ operator++()
369+ {
370+ any_input_iterator<_type, _tPointer, _tReference>::operator++();
371+ return *this;
372+ }
373+ YB_ITERATOR_MEMBER_POSTFIX(++, any_forward_iterator)
374+};
375+
376+YB_ITERATOR_OP2(operator==, bool, any_forward_iterator, x.equals(y))
377+
378+YB_ITERATOR_OP2(operator!=, bool, any_forward_iterator, !(x == y))
379+
380+YB_ITERATOR_OP1(is_undereferenceable, bool, any_forward_iterator,
381+ i.check_undereferenceable())
382+
383+typedef any_forward_iterator<void_ref, ptrdiff_t, void*, void_ref>
384+ forward_monomorphic_iterator;
385+
386+
387+/*!
388+\ingroup iterator_adaptors
389+\brief 动态泛型双向迭代器。
390+*/
391+template<typename _type, typename _tDifference = ptrdiff_t,
392+ typename _tPointer = _type*, typename _tReference = _type&>
393+class any_bidirectional_iterator
394+ : public any_forward_iterator<_type, _tDifference, _tPointer, _tReference>
321395 {
322- return i.check_undereferencable();
323-}
396+public:
397+ typedef std::bidirectional_iterator_tag iterator_category;
398+ typedef _tPointer pointer;
399+ typedef _tReference reference;
324400
325-//! \since build 347
326-typedef any_input_iterator<void_ref, void*, void_ref>
327- input_monomorphic_iterator;
401+ any_bidirectional_iterator() = default;
402+ template<typename _tIterator>
403+ any_bidirectional_iterator(_tIterator&& i)
404+ : any_input_iterator<_type, _tPointer, _tReference>(yforward(i))
405+ {}
406+ any_bidirectional_iterator(const any_bidirectional_iterator&) = default;
407+ any_bidirectional_iterator(any_bidirectional_iterator&&) = default;
408+
409+ any_bidirectional_iterator&
410+ operator++()
411+ {
412+ any_forward_iterator<_type, _tPointer, _tReference>::operator++();
413+ return *this;
414+ }
415+ YB_ITERATOR_MEMBER_POSTFIX(++, any_bidirectional_iterator)
416+
417+ any_bidirectional_iterator&
418+ operator--()
419+ {
420+ yassume(this->manager);
421+
422+ this->manager(this->storage, this->storage, any_ops::decrease);
423+ return *this;
424+ }
425+ YB_ITERATOR_MEMBER_POSTFIX(--, any_bidirectional_iterator)
426+};
427+
428+YB_ITERATOR_OP2(operator==, bool, any_bidirectional_iterator, x.equals(y))
429+
430+YB_ITERATOR_OP2(operator!=, bool, any_bidirectional_iterator, !(x == y))
431+
432+YB_ITERATOR_OP1(is_undereferenceable, bool, any_bidirectional_iterator,
433+ i.check_undereferenceable())
434+
435+typedef any_bidirectional_iterator<void_ref, ptrdiff_t, void*, void_ref>
436+ bidirectional_monomorphic_iterator;
437+
438+
439+#undef YB_ITERATOR_OP1
440+#undef YB_ITERATOR_OP2
441+#undef YB_ITERATOR_MEMBER_POSTFIX
442+
443+//@}
328444
329445 } // namespace ystdex;
330446
diff -r 17b7acdaf1f3 -r 26b75853b16a YBase/include/ystdex/cstdio.h
--- a/YBase/include/ystdex/cstdio.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YBase/include/ystdex/cstdio.h Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file cstdio.h
1212 \ingroup YStandardEx
1313 \brief ISO C 标准输入/输出扩展。
14-\version r371
14+\version r388
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 245
1717 \par 创建时间:
1818 2011-09-21 08:30:08 +0800
1919 \par 修改时间:
20- 2013-03-06 19:00 +0800
20+ 2013-04-22 13:04 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -32,8 +32,7 @@
3232 #include <cstdio>
3333 #include <ios> // for std::ios_base::openmode;
3434 #include <iterator>
35-#include "memory.hpp" \
36- // for ystdex::is_dereferencable, ystdex::is_undereferencable;
35+#include "memory.hpp" // for ystdex::is_undereferenceable;
3736
3837 namespace ystdex
3938 {
@@ -108,7 +107,7 @@
108107 : stream(), value()
109108 {}
110109 /*!
111- \brief 构造:使用流指针。
110+ \brief 构造:使用流引用。
112111 \pre <tt>stream</tt>。
113112 \post <tt>stream == &s</tt> 。
114113 */
@@ -183,23 +182,12 @@
183182
184183
185184 /*!
186-\ingroup is_dereferencable
187-\brief 判断 ifile_iterator 实例是否确定为可解引用。
188-\since build 249
185+\ingroup is_undereferenceable
186+\brief 判断 ifile_iterator 实例是否确定为不可解引用。
187+\since build 400
189188 */
190189 inline bool
191-is_dereferencable(const ifile_iterator& i)
192-{
193- return i.get_stream();
194-}
195-
196-/*!
197-\ingroup is_undereferencable
198-\brief 判断 ifile_iterator 实例是否确定为不可解引用。
199-\since build 250
200-*/
201-inline bool
202-is_undereferencable(const ifile_iterator& i)
190+is_undereferenceable(const ifile_iterator& i)
203191 {
204192 return !i.get_stream();
205193 }
diff -r 17b7acdaf1f3 -r 26b75853b16a YBase/include/ystdex/iterator.hpp
--- a/YBase/include/ystdex/iterator.hpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YBase/include/ystdex/iterator.hpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file iterator.hpp
1212 \ingroup YStandardEx
1313 \brief 通用迭代器。
14-\version r2265
14+\version r2305
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 189
1717 \par 创建时间:
1818 2011-01-27 23:01:00 +0800
1919 \par 修改时间:
20- 2013-03-24 10:49 +0800
20+ 2013-04-22 01:00 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -30,7 +30,7 @@
3030
3131 #include "type_op.hpp" // for std::remove_reference, ystdex::*_tag;
3232 #include <iterator> // for std::make_move_iterator, std::iterator,
33-// std::iterator_traits, std::iterator_category;
33+// std::iterator_traits;
3434 #include <utility> // for std::make_pair;
3535 #include <memory> // for std::addressof;
3636
@@ -133,21 +133,20 @@
133133 \since build 290
134134
135135 转换指针为类类型的随机迭代器。
136+\todo 和 std::pointer_traits 交互。
136137 */
137138 template<typename _type>
138-class pointer_iterator : private std::iterator<typename
139- std::iterator_traits<_type*>::iterator_category, _type>
139+class pointer_iterator
140140 {
141-protected:
142- typedef typename std::iterator<typename
143- std::iterator_traits<_type*>::iterator_category, _type> base_type;
144-
145141 public:
146- typedef typename base_type::difference_type difference_type;
147- typedef typename base_type::value_type value_type;
148- typedef typename base_type::pointer pointer;
149- typedef typename base_type::reference reference;
150- typedef typename base_type::iterator_category iterator_category;
142+ typedef _type* iterator_type;
143+ typedef typename std::iterator_traits<iterator_type>::iterator_category
144+ iterator_category;
145+ typedef typename std::iterator_traits<iterator_type>::value_type value_type;
146+ typedef typename std::iterator_traits<iterator_type>::difference_type
147+ difference_type;
148+ typedef typename std::iterator_traits<iterator_type>::pointer pointer;
149+ typedef typename std::iterator_traits<iterator_type>::reference reference;
151150
152151 protected:
153152 mutable pointer current;
@@ -301,16 +300,15 @@
301300 typename _tTraits = std::iterator_traits<_tIterator>>
302301 class pseudo_iterator
303302 {
304-protected:
305- typedef _tTraits traits_type;
306-
307303 public:
308304 typedef _tIterator iterator_type;
309- typedef typename traits_type::iterator_category iterator_category;
305+ //! \since build 400
306+ typedef _tTraits traits_type;
307+ typedef typename traits_type::iterator_category iterator_category;
310308 typedef typename traits_type::value_type value_type;
311309 typedef typename traits_type::difference_type difference_type;
310+ typedef typename traits_type::pointer pointer;
312311 typedef typename traits_type::reference reference;
313- typedef typename traits_type::pointer pointer;
314312
315313 value_type value;
316314
@@ -451,12 +449,11 @@
451449 transformed_type;
452450 //! \since build 357
453451 //@{
454- typedef std::iterator_traits<iterator_type> traits_type;
455- typedef typename traits_type::iterator_category iterator_category;
456452 typedef typename add_rvalue_reference<
457453 decltype(*std::declval<transformed_type>())>::type reference;
458454 typedef typename remove_reference<reference>::type value_type;
459- typedef typename traits_type::difference_type difference_type;
455+ typedef typename std::iterator_traits<iterator_type>::difference_type
456+ difference_type;
460457 typedef typename add_pointer<value_type>::type pointer;
461458 //@}
462459
@@ -646,17 +643,16 @@
646643 class _tTraits = std::iterator_traits<_tMaster>>
647644 class pair_iterator : private std::pair<_tMaster, _tSlave>
648645 {
649-protected:
650- typedef _tTraits traits_type;
651-
652646 public:
653647 typedef std::pair<_tMaster, _tSlave> pair_type;
654648 typedef _tMaster iterator_type;
649+ //! \since build 400
650+ typedef _tTraits traits_type;
655651 typedef typename traits_type::iterator_category iterator_category;
656652 typedef typename traits_type::value_type value_type;
657653 typedef typename traits_type::difference_type difference_type;
654+ typedef typename traits_type::pointer pointer;
658655 typedef typename traits_type::reference reference;
659- typedef typename traits_type::pointer pointer;
660656
661657 yconstfn
662658 pair_iterator()
@@ -811,19 +807,15 @@
811807 根据指定类型提供的下标操作枚举其成员的随机访问迭代器。
812808 */
813809 template<class _tContainer, typename _type>
814-class subscriptive_iterator : private std::iterator<typename
815- std::random_access_iterator_tag, _type, ptrdiff_t, _type*, _type&>
810+class subscriptive_iterator
816811 {
817-protected:
818- typedef std::iterator<typename std::random_access_iterator_tag,
819- _type, ptrdiff_t, _type*, _type&> base_type;
820-
821812 public:
822813 typedef _tContainer container_type;
823- typedef typename base_type::difference_type difference_type;
824- typedef typename base_type::value_type value_type;
825- typedef typename base_type::pointer pointer;
826- typedef typename base_type::reference reference;
814+ typedef std::random_access_iterator_tag iterator_category;
815+ typedef _type value_type;
816+ typedef ptrdiff_t difference_type;
817+ typedef _type* pointer;
818+ typedef _type& reference;
827819
828820 protected:
829821 _tContainer* p_cont;
diff -r 17b7acdaf1f3 -r 26b75853b16a YBase/include/ystdex/memory.hpp
--- a/YBase/include/ystdex/memory.hpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YBase/include/ystdex/memory.hpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file memory.hpp
1212 \ingroup YStandardEx
1313 \brief 存储和智能指针特性。
14-\version r424
14+\version r449
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 209
1717 \par 创建时间:
1818 2011-05-14 12:25:13 +0800
1919 \par 修改时间:
20- 2013-03-06 13:13 +0800
20+ 2013-04-22 13:07 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -34,46 +34,23 @@
3434 namespace ystdex
3535 {
3636
37-/*! \defgroup is_dereferencable Is Dereferencable Iterator
38-\brief 判断迭代器实例是否确定可解引用。
37+/*! \defgroup is_undereferenceable Is Undereferenceable Iterator
38+\brief 判断迭代器实例是否为可解引用。
3939 \tparam _tIterator 迭代器类型。
40-\note 注意返回 \c false 不表示参数实际不可解引用。
41-\note 默认实现对参数转换为 \c bool 类型判断是否为 true 。
42-\since build 249
40+\note 注意返回 \c false 不表示参数实际可解引用。
41+\note 默认实现对参数转换为 \c bool 类型判断是否为 false 。
42+\since build 400
4343 */
4444 //@{
4545 template<typename _tIterator>
4646 yconstfn bool
47-is_dereferencable(const _tIterator&)
47+is_undereferenceable(const _tIterator&)
4848 {
4949 return false;
5050 }
5151 template<typename _type>
5252 yconstfn bool
53-is_dereferencable(_type* p)
54-{
55- return bool(p);
56-}
57-//@}
58-
59-
60-/*! \defgroup is_undereferencable Is Undereferencable Iterator
61-\brief 判断迭代器实例是否为可解引用。
62-\tparam _tIterator 迭代器类型。
63-\note 注意返回 \c false 不表示参数实际可解引用。
64-\note 默认实现对参数转换为 \c bool 类型判断是否为 false 。
65-\since build 250
66-*/
67-//@{
68-template<typename _tIterator>
69-yconstfn bool
70-is_undereferencable(const _tIterator&)
71-{
72- return false;
73-}
74-template<typename _type>
75-yconstfn bool
76-is_undereferencable(_type* p)
53+is_undereferenceable(_type* p)
7754 {
7855 return !bool(p);
7956 }
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/YFramework.cbp
--- a/YFramework/YFramework.cbp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/YFramework.cbp Wed Apr 24 18:40:44 2013 +0800
@@ -56,6 +56,7 @@
5656 </Compiler>
5757 <Unit filename="data/cp113.bin" />
5858 <Unit filename="data/default_font.bin" />
59+ <Unit filename="include/CHRLib/Convert.hpp" />
5960 <Unit filename="include/CHRLib/MapEx.h" />
6061 <Unit filename="include/CHRLib/chrdef.h" />
6162 <Unit filename="include/CHRLib/chrmap.h" />
@@ -86,6 +87,7 @@
8687 <Unit filename="include/YCLib/Video.h" />
8788 <Unit filename="include/YCLib/ycommon.h" />
8889 <Unit filename="include/YSLib/Adaptor/Font.h" />
90+ <Unit filename="include/YSLib/Adaptor/YTextBase.h" />
8991 <Unit filename="include/YSLib/Adaptor/config.h" />
9092 <Unit filename="include/YSLib/Adaptor/yadaptor.h" />
9193 <Unit filename="include/YSLib/Adaptor/ycont.h" />
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/YFramework.vcxproj
--- a/YFramework/YFramework.vcxproj Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/YFramework.vcxproj Wed Apr 24 18:40:44 2013 +0800
@@ -287,6 +287,9 @@
287287 <ClCompile Include="source\YSLib\UI\ywidget.cpp" />
288288 <ClCompile Include="source\YSLib\UI\ywindow.cpp" />
289289 </ItemGroup>
290+ <ItemGroup>
291+ <Text Include="..\doc\ChangeLog.PreAlpha4.txt" />
292+ </ItemGroup>
290293 <PropertyGroup Label="Globals">
291294 <ProjectGuid>{305D480F-C3DC-4A3D-915A-88E9D2224742}</ProjectGuid>
292295 <Keyword>MakeFileProj</Keyword>
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/YFramework.vcxproj.filters
--- a/YFramework/YFramework.vcxproj.filters Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/YFramework.vcxproj.filters Wed Apr 24 18:40:44 2013 +0800
@@ -929,4 +929,9 @@
929929 <Filter>源文件\Helper</Filter>
930930 </ClCompile>
931931 </ItemGroup>
932+ <ItemGroup>
933+ <Text Include="..\doc\ChangeLog.PreAlpha4.txt">
934+ <Filter>文档</Filter>
935+ </Text>
936+ </ItemGroup>
932937 </Project>
\ No newline at end of file
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/CHRLib/Convert.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/YFramework/include/CHRLib/Convert.hpp Wed Apr 24 18:40:44 2013 +0800
@@ -0,0 +1,53 @@
1+/*
2+ Copyright by FrankHB 2013.
3+
4+ This file is part of the YSLib project, and may only be used,
5+ modified, and distributed under the terms of the YSLib project
6+ license, LICENSE.TXT. By continuing to use, modify, or distribute
7+ this file you indicate that you have read the license and
8+ understand and accept it fully.
9+*/
10+
11+/*! \file Convert.hpp
12+\ingroup CHRLib
13+\brief 转换模版。
14+\version r52
15+\author FrankHB <frankhb1989@gmail.com>
16+\since build 400
17+\par 创建时间:
18+ 2013-04-23 10:18:20 +0800
19+\par 修改时间:
20+ 2013-04-23 10:30 +0800
21+\par 文本编码:
22+ UTF-8
23+\par 模块名称:
24+ CHRLib::Convert
25+*/
26+
27+
28+#ifndef CHRLIB_INC_Convert_hpp_
29+#define CHRLIB_INC_Convert_hpp_ 1
30+
31+#include "chrmap.h"
32+#include <ystdex/any_iterator.hpp> // for ystdex::input_monomorphic_iterator;
33+
34+CHRLIB_BEGIN
35+
36+template<typename _tIn, typename _fConv>
37+ConversionResult
38+ConvertCharacter(_fConv f, ucs2_t& uc, _tIn&& it, ConversionState&& st)
39+{
40+ return f(uc, ystdex::input_monomorphic_iterator(std::ref(it)),
41+ std::move(st));
42+}
43+template<typename _tIn, typename _fConv>
44+ConversionResult
45+ConvertCharacter(_fConv f, _tIn&& it, ConversionState&& st)
46+{
47+ return f(ystdex::input_monomorphic_iterator(std::ref(it)), std::move(st));
48+}
49+
50+CHRLIB_END
51+
52+#endif
53+
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/CHRLib/chrdef.h
--- a/YFramework/include/CHRLib/chrdef.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/CHRLib/chrdef.h Wed Apr 24 18:40:44 2013 +0800
@@ -16,13 +16,13 @@
1616 /*! \file chrdef.h
1717 \ingroup CHRLib
1818 \brief CHRLib 类型定义。
19-\version r643
19+\version r644
2020 \author FrankHB <frankhb1989@gmail.com>
2121 \since 早于 build 132
2222 \par 创建时间:
2323 2009-11-17 17:52:35 +0800
2424 \par 修改时间:
25- 2013-01-04 16:55 +0800
25+ 2013-04-24 00:26 +0800
2626 \par 字符集:
2727 UTF-8
2828 \par 模块名称:
@@ -35,7 +35,7 @@
3535
3636 #include <ydef.h>
3737 #include <string> // for std::char_traits;
38-#include <YCLib/Platform.h> // for YF_API;
38+#include "YCLib/Platform.h" // for YF_API;
3939
4040 #define CHRLIB_BEGIN namespace CHRLib {
4141 #define CHRLIB_END }
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/CHRLib/chrproc.h
--- a/YFramework/include/CHRLib/chrproc.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/CHRLib/chrproc.h Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2009 - 2012.
2+ Copyright by FrankHB 2009 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -8,16 +8,16 @@
88 understand and accept it fully.
99 */
1010
11-/*! \file chrproc.cpp
11+/*! \file chrproc.h
1212 \ingroup CHRLib
1313 \brief 字符编码处理。
14-\version r734
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r751
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-11-17 17:52:35 +0800
1919 \par 修改时间:
20- 2012-12-12 00:03 +0800
20+ 2013-04-23 10:46 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,8 +25,8 @@
2525 */
2626
2727
28-#ifndef CHRLIB_INC_CHRPROC_H_
29-#define CHRLIB_INC_CHRPROC_H_ 1
28+#ifndef CHRLIB_INC_chrproc_h_
29+#define CHRLIB_INC_chrproc_h_ 1
3030
3131 #include "chrmap.h"
3232 #include <cstdio>
@@ -79,6 +79,7 @@
7979 //@}
8080 /*!
8181 \brief 按指定编码和转换状态转换字符流中字符为 UCS-2 字符,返回转换的字节数。
82+\pre 断言:指针参数非空。
8283 \since build 291
8384 */
8485 //@{
@@ -102,6 +103,8 @@
102103 {
103104 return MBCToUC(c, enc, std::move(st));
104105 }
106+//! \pre 断言:指针参数非空。
107+//@{
105108 YF_API ConversionResult
106109 MBCToUC(std::FILE*, Encoding, ConversionState&& = {});
107110 inline ConversionResult
@@ -110,9 +113,11 @@
110113 return MBCToUC(fp, enc, std::move(st));
111114 }
112115 //@}
116+//@}
113117
114118 /*!
115119 \brief 按指定编码转换 UCS-2 字符中字符为字符串表示的多字节字符,返回转换的字节数。
120+\pre 断言: 指针参数非空 。
116121 \since build 305
117122 */
118123 YF_API size_t
@@ -121,6 +126,7 @@
121126
122127 /*!
123128 \brief 按指定编码转换 MBCS 字符串为 UTF-16LE 字符串,返回转换的串长。
129+\pre 断言: 指针参数非空 。
124130 \since build 291
125131 */
126132 YF_API size_t
@@ -128,6 +134,7 @@
128134
129135 /*!
130136 \brief 按指定编码转换 UTF-16LE 字符串为 MBCS 字符串,返回转换的串长。
137+\pre 断言: 指针参数非空 。
131138 \since build 291
132139 */
133140 YF_API size_t
@@ -135,6 +142,7 @@
135142
136143 /*!
137144 \brief 转换 UCS-4 字符串为 UCS-2 字符串,返回转换的串长。
145+\pre 断言: 指针参数非空 。
138146 */
139147 YF_API size_t
140148 UCS4ToUCS2(ucs2_t*, const ucs4_t*);
@@ -158,6 +166,7 @@
158166
159167 /*!
160168 \brief 复制 UCS-2LE 字符串为多字节字符串。
169+\pre 断言: 指针参数非空 。
161170 \note 空间由 std::free 释放。
162171 \since build 305
163172 */
@@ -166,6 +175,7 @@
166175
167176 /*!
168177 \brief 复制多字节字符串为 UCS-2/UTF-16LE 字符串。
178+\pre 断言: 指针参数非空 。
169179 \note 空间由 std::free 释放。
170180 \since build 291
171181 */
@@ -173,12 +183,14 @@
173183 ucsdup(const char*, Encoding = CS_Default);
174184 /*!
175185 \brief 复制 UCS-2 字符串。
186+\pre 断言: 指针参数非空 。
176187 \note 空间由 std::free 释放。
177188 */
178189 YF_API ucs2_t*
179190 ucsdup(const ucs2_t*);
180191 /*!
181192 \brief 复制 UCS-4 字符串为 UCS-2 字符串。
193+\pre 断言: 指针参数非空 。
182194 \note 空间由 std::free 释放。
183195 */
184196 YF_API ucs2_t*
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/CHRLib/smap.hpp
--- a/YFramework/include/CHRLib/smap.hpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/CHRLib/smap.hpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file smap.hpp
1212 \ingroup CHRLib
1313 \brief 静态编码映射。
14-\version r1828
14+\version r1839
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 247
1717 \par 创建时间:
1818 2009-11-17 17:53:21 +0800
1919 \par 修改时间:
20- 2013-02-02 12:55 +0800
20+ 2013-04-22 12:46 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,8 +25,8 @@
2525 */
2626
2727
28-#ifndef CHRLIB_INC_SMAP_HPP_
29-#define CHRLIB_INC_SMAP_HPP_ 1
28+#ifndef CHRLIB_INC_smap_hpp_
29+#define CHRLIB_INC_smap_hpp_ 1
3030
3131 #include "chrmap.h"
3232 #include <ystdex/cstdio.h>
@@ -47,7 +47,7 @@
4747 static_assert(!std::is_volatile<typename std::remove_reference<
4848 _tState>::type>::value, "Volatile state is not supported.");
4949
50- if(YB_UNLIKELY(is_undereferencable(i)))
50+ if(YB_UNLIKELY(is_undereferenceable(i)))
5151 return false;
5252
5353 const byte r(*i);
@@ -124,10 +124,8 @@
124124 return ConversionResult::Invalid;
125125 if(((seq[0] ^ 0xE0) & 0xF0) == 0)
126126 {
127- uc = (((seq[0] & 0x0F) << 4
128- | (seq[1] & 0x3C) >> 2) << 8)
129- | ((seq[1] & 0x3) << 6)
130- | (seq[2] & 0x3F);
127+ uc = (((seq[0] & 0x0F) << 4 | (seq[1] & 0x3C) >> 2) << 8)
128+ | ((seq[1] & 0x3) << 6) | (seq[2] & 0x3F);
131129 break;
132130 }
133131 case 3:
@@ -137,10 +135,8 @@
137135 return ConversionResult::Invalid;
138136 if(YB_LIKELY(((seq[0] ^ 0xF0) & 0xF8) == 0))
139137 {
140- uc = (((seq[0] & 0x0F) << 4
141- | (seq[1] & 0x3C) >> 2) << 8)
142- | ((seq[1] & 0x3) << 6)
143- | (seq[2] & 0x3F);
138+ uc = (((seq[0] & 0x0F) << 4 | (seq[1] & 0x3C) >> 2) << 8)
139+ | ((seq[1] & 0x3) << 6) | (seq[2] & 0x3F);
144140 break;
145141 }
146142 return ConversionResult::Unhandled;
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Adaptor/Font.h
--- a/YFramework/include/YSLib/Adaptor/Font.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Adaptor/Font.h Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file Font.h
1212 \ingroup Adaptor
1313 \brief 平台无关的字体库。
14-\version r2826
14+\version r2827
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 296
1717 \par 创建时间:
1818 2009-11-12 22:02:40 +0800
1919 \par 修改时间:
20- 2013-02-02 12:51 +0800
20+ 2013-04-24 00:36 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -32,6 +32,7 @@
3232 #include "../Core/yobject.h"
3333 #include <string>
3434 #include "../Core/yexcept.h"
35+#include "YTextBase.h"
3536
3637 //包含 FreeType2 。
3738
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Adaptor/YTextBase.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/YFramework/include/YSLib/Adaptor/YTextBase.h Wed Apr 24 18:40:44 2013 +0800
@@ -0,0 +1,51 @@
1+/*
2+ Copyright by FrankHB 2013.
3+
4+ This file is part of the YSLib project, and may only be used,
5+ modified, and distributed under the terms of the YSLib project
6+ license, LICENSE.TXT. By continuing to use, modify, or distribute
7+ this file you indicate that you have read the license and
8+ understand and accept it fully.
9+*/
10+
11+/*! \file YTextBase.h
12+\ingroup Adaptor
13+\brief 外部库关联。
14+\version r50
15+\author FrankHB <frankhb1989@gmail.com>
16+\since build 400
17+\par 创建时间:
18+ 2013-04-24 00:02:44 +0800
19+\par 修改时间:
20+ 2013-04-24 00:11 +0800
21+\par 文本编码:
22+ UTF-8
23+\par 模块名称:
24+ YSLib::Adaptor::YTextBase
25+*/
26+
27+
28+#ifndef YSL_INC_Adaptor_YTextBase_H_
29+#define YSL_INC_Adaptor_YTextBase_H_ 1
30+
31+#include "yadaptor.h"
32+
33+//包含 CHRLib 。
34+#include "CHRLib/chrproc.h"
35+
36+YSL_BEGIN
37+
38+YSL_BEGIN_NAMESPACE(Text)
39+
40+using namespace CHRLib;
41+
42+YSL_END_NAMESPACE(Text)
43+
44+using Text::ucs4_t;
45+using Text::ucs2_t;
46+using Text::ucsint_t;
47+
48+YSL_END
49+
50+#endif
51+
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Adaptor/config.h
--- a/YFramework/include/YSLib/Adaptor/config.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Adaptor/config.h Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2010 - 2012.
2+ Copyright by FrankHB 2010 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -11,13 +11,13 @@
1111 /*! \file config.h
1212 \ingroup Adaptor
1313 \brief YSLib 库配置。
14-\version r619
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r624
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since build 161
1717 \par 创建时间:
1818 2010-10-09 09:25:26 +0800
1919 \par 修改时间:
20- 2012-09-04 12:24 +0800
20+ 2013-04-24 00:26 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,10 +25,10 @@
2525 */
2626
2727
28-#ifndef YSL_INC_ADAPTOR_CONFIG_H_
29-#define YSL_INC_ADAPTOR_CONFIG_H_ 1
28+#ifndef YSL_INC_Adaptor_config_h_
29+#define YSL_INC_Adaptor_config_h_ 1
3030
31-#include <YCLib/Platform.h>
31+#include "YCLib/Platform.h"
3232
3333 //#define NDEBUG //!< 非调试模式。
3434
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Adaptor/yadaptor.h
--- a/YFramework/include/YSLib/Adaptor/yadaptor.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Adaptor/yadaptor.h Wed Apr 24 18:40:44 2013 +0800
@@ -16,13 +16,13 @@
1616 /*! \file yadaptor.h
1717 \ingroup Adaptor
1818 \brief 外部库关联。
19-\version r1428
19+\version r1456
2020 \author FrankHB <frankhb1989@gmail.com>
2121 \since 早于 build 132
2222 \par 创建时间:
2323 2010-02-22 20:16:21 +0800
2424 \par 修改时间:
25- 2013-01-14 21:57 +0800
25+ 2013-04-24 00:27 +0800
2626 \par 文本编码:
2727 UTF-8
2828 \par 模块名称:
@@ -30,35 +30,27 @@
3030 */
3131
3232
33-#ifndef YSL_INC_ADAPTOR_YADAPTOR_H_
34-#define YSL_INC_ADAPTOR_YADAPTOR_H_ 1
33+#ifndef YSL_INC_Adaptor_yadaptor_h_
34+#define YSL_INC_Adaptor_yadaptor_h_ 1
3535
3636 //引入平台设置和存储调试设施。
3737 #include "ynew.h"
3838
39+// 确保包含标准库必要部分。
40+#include <cmath>
41+#include <algorithm> // for std::min, std::max;
42+
3943 //包含 YStandardEx 公用部分。
4044 #include <ystdex/functional.hpp>
4145 #include <ystdex/utility.hpp>
46+#include <ystdex/string.hpp> // for std::to_string, ystdex::to_string;
4247
4348 //包含 YCLib 公用部分。
44-#include <YCLib/ycommon.h>
45-#include <YCLib/Keys.h>
46-#include <YCLib/Timer.h>
47-#include <YCLib/FileSystem.h>
48-#include <YCLib/Video.h>
49-
50-//包含 CHRLib 。
51-#include <CHRLib/chrproc.h>
52-
53-// 确保包含 C 标准库必要部分。
54-#include <cstddef>
55-#include <cstdint>
56-#include <climits>
57-#include <cmath>
58-
59-// 确保包含 C++ 标准库必要部分。
60-#include <algorithm> // for std::min, std::max;
61-#include <ystdex/string.hpp> // for std::to_string, ystdex::to_string;
49+#include "YCLib/ycommon.h"
50+#include "YCLib/Keys.h"
51+#include "YCLib/Timer.h"
52+#include "YCLib/FileSystem.h"
53+#include "YCLib/Video.h"
6254
6355 /*
6456 !\brief YSLib 命名空间。
@@ -218,10 +210,6 @@
218210 namespace KeyCodes = platform::KeyCodes;
219211 using platform::KeyInput;
220212
221-//! \brief 设计模式。
222-YSL_BEGIN_NAMESPACE(Pattern)
223-YSL_END_NAMESPACE(Pattern)
224-
225213 //! \brief 图形处理。
226214 YSL_BEGIN_NAMESPACE(Drawing)
227215
@@ -240,16 +228,6 @@
240228
241229 YSL_END_NAMESPACE(Drawing)
242230
243-YSL_BEGIN_NAMESPACE(Text)
244-
245-using namespace CHRLib;
246-
247-YSL_END_NAMESPACE(Text)
248-
249-using Text::ucs4_t;
250-using Text::ucs2_t;
251-using Text::ucsint_t;
252-
253231 YSL_END
254232
255233 #endif
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Adaptor/ycont.h
--- a/YFramework/include/YSLib/Adaptor/ycont.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Adaptor/ycont.h Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2010 - 2012.
2+ Copyright by FrankHB 2010 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -11,13 +11,13 @@
1111 /*! \file ycont.h
1212 \ingroup Adaptor
1313 \brief 容器、拟容器和适配器。
14-\version r654
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r661
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since build 161
1717 \par 创建时间:
1818 2010-10-09 09:25:26 +0800
1919 \par 修改时间:
20- 2012-09-04 10:53 +0800
20+ 2013-04-24 00:29 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,12 +25,13 @@
2525 */
2626
2727
28-#ifndef YSL_INC_ADAPTOR_YCONT_H_
29-#define YSL_INC_ADAPTOR_YCONT_H_ 1
28+#ifndef YSL_INC_Adaptor_ycont_h_
29+#define YSL_INC_Adaptor_ycont_h_ 1
3030
3131 #include "yadaptor.h"
3232 #include <utility>
3333 #include <tuple>
34+#include "CHRLib/chrdef.h"
3435
3536
3637 //包含 flex_string 。
@@ -154,8 +155,8 @@
154155 typedef GSStringTemplate<char>::basic_string string;
155156
156157 // YSLib 基本字符串(使用 UCS-2LE / UCS-4LE )。
157-typedef GSStringTemplate<ucs2_t>::basic_string ucs2string;
158-typedef GSStringTemplate<ucs4_t>::basic_string ucs4string;
158+typedef GSStringTemplate<CHRLib::ucs2_t>::basic_string ucs2string;
159+typedef GSStringTemplate<CHRLib::ucs4_t>::basic_string ucs4string;
159160
160161 YSL_END
161162
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Core/ystring.h
--- a/YFramework/include/YSLib/Core/ystring.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Core/ystring.h Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ystring.h
1212 \ingroup Core
1313 \brief 基础字符串管理。
14-\version r2108
14+\version r2109
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2010-03-05 22:06:05 +0800
1919 \par 修改时间:
20- 2013-03-11 10:35 +0800
20+ 2013-04-24 00:14 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -30,6 +30,7 @@
3030
3131 #include "yobject.h"
3232 #include "../Adaptor/ycont.h"
33+#include "../Adaptor/YTextBase.h"
3334
3435 YSL_BEGIN
3536
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Service/yfile.h
--- a/YFramework/include/YSLib/Service/yfile.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Service/yfile.h Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2009 - 2012.
2+ Copyright by FrankHB 2009 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -11,13 +11,13 @@
1111 /*! \file yfile.h
1212 \ingroup Service
1313 \brief 平台无关的文件抽象。
14-\version r1078
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r1083
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-11-24 23:14:41 +0800
1919 \par 修改时间:
20- 2012-12-11 21:30 +0800
20+ 2013-04-24 00:35 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -25,11 +25,12 @@
2525 */
2626
2727
28-#ifndef YSL_INC_CORE_YFILE_H_
29-#define YSL_INC_CORE_YFILE_H_ 1
28+#ifndef YSL_INC_Core_yfile_h_
29+#define YSL_INC_Core_yfile_h_ 1
3030
3131 #include "../Core/ycutil.h"
3232 #include <cwctype>
33+#include "../Adaptor/YTextBase.h"
3334
3435 YSL_BEGIN
3536
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/include/YSLib/Service/yftext.h
--- a/YFramework/include/YSLib/Service/yftext.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/include/YSLib/Service/yftext.h Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2009 - 2012.
2+ Copyright by FrankHB 2009 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -11,13 +11,13 @@
1111 /*! \file yftext.h
1212 \ingroup Service
1313 \brief 平台无关的文本文件抽象。
14-\version r768
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r771
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-11-24 23:14:41 +0800
1919 \par 修改时间:
20- 2012-12-11 21:38 +0800
20+ 2013-04-22 16:04 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -66,7 +66,6 @@
6666
6767 /*!
6868 \brief 构造:使用指定文件名、编码和模式初始化文本文件对象。
69- \note 忽略二进制模式。
7069 \note 当打开文件大小为零且以可写方式打开时按编码写入 BOM 。
7170 \since build 341
7271 */
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/source/CHRLib/chrproc.cpp
--- a/YFramework/source/CHRLib/chrproc.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/source/CHRLib/chrproc.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) by Franksoft 2009 - 2012.
2+ Copyright by FrankHB 2009 - 2013.
33
44 This file is part of the YSLib project, and may only be used,
55 modified, and distributed under the terms of the YSLib project
@@ -11,13 +11,13 @@
1111 /*! \file chrproc.cpp
1212 \ingroup CHRLib
1313 \brief 字符编码处理。
14-\version r1116
15-\author FrankHB<frankhb1989@gmail.com>
14+\version r1160
15+\author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-11-17 17:53:21 +0800
1919 \par 修改时间:
20- 2012-11-06 15:09 +0800
20+ 2013-04-24 14:31 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -32,7 +32,7 @@
3232 #include <cwchar>
3333 #include <ystdex/cstdio.h>
3434 #include <ystdex/cstring.h>
35-#include <ystdex/any_iterator.hpp>
35+#include "CHRLib/Convert.hpp"
3636
3737 CHRLIB_BEGIN
3838
@@ -44,26 +44,24 @@
4444 using ystdex::ntctslen;
4545 using ystdex::input_monomorphic_iterator;
4646
47-
4847 ConversionResult
4948 MBCToUC(ucs2_t& uc, const char*& c, Encoding enc, ConversionState&& st)
5049 {
5150 if(const auto pfun = FetchMapperPtr<ConversionResult(ucs2_t&,
5251 input_monomorphic_iterator&&, ConversionState&&)>(enc))
53- return pfun(uc, input_monomorphic_iterator(std::ref(c)), std::move(st));
52+ return ConvertCharacter(pfun, uc, c, std::move(st));
5453 return ConversionResult::Unhandled;
5554 }
5655 ConversionResult
5756 MBCToUC(ucs2_t& uc, std::FILE* fp, Encoding enc, ConversionState&& st)
5857 {
59- if(std::feof(fp))
60- return ConversionResult::BadSource;
58+ yconstraint(fp);
59+
6160 if(const auto pfun = FetchMapperPtr<ConversionResult(ucs2_t&,
6261 input_monomorphic_iterator&&, ConversionState&&)>(enc))
6362 {
6463 ystdex::ifile_iterator i(*fp);
65- const auto r(pfun(uc, input_monomorphic_iterator(std::ref(i)),
66- std::move(st)));
64+ const auto r(ConvertCharacter(pfun, uc, i, std::move(st)));
6765
6866 std::ungetc(*i, fp);
6967 return r;
@@ -75,20 +73,21 @@
7573 {
7674 if(const auto pfun = FetchMapperPtr<ConversionResult(
7775 input_monomorphic_iterator&&, ConversionState&&)>(enc))
78- return pfun(input_monomorphic_iterator(std::ref(c)), std::move(st));
76+ return ConvertCharacter(pfun, c, std::move(st));
7977 return ConversionResult::Unhandled;
8078 }
8179 ConversionResult
8280 MBCToUC(std::FILE* fp, Encoding enc, ConversionState&& st)
8381 {
82+ yconstraint(fp);
83+
8484 if(const auto pfun = FetchMapperPtr<ConversionResult(
8585 input_monomorphic_iterator&&, ConversionState&&)>(enc))
8686 {
8787 ystdex::ifile_iterator i(*fp);
88- auto r(pfun(input_monomorphic_iterator(std::ref(i)), std::move(st)));
88+ const auto r(ConvertCharacter(pfun, i, std::move(st)));
8989
90- if(is_dereferencable(i))
91- std::ungetc(*i, fp);
90+ std::ungetc(*i, fp);
9291 return r;
9392 }
9493 return ConversionResult::Unhandled;
@@ -97,6 +96,8 @@
9796 size_t
9897 UCToMBC(char* d, const ucs2_t& s, Encoding enc)
9998 {
99+ yconstraint(d);
100+
100101 size_t l(0);
101102
102103 if(const auto pfun = FetchMapperPtr<byte(char*, const ucs2_t&)>(enc))
@@ -108,10 +109,19 @@
108109 size_t
109110 MBCSToUCS2(ucs2_t* d, const char* s, Encoding enc)
110111 {
111- ucs2_t* const p(d);
112+ yconstraint(d),
113+ yconstraint(s);
112114
113- while(*s)
114- MBCToUC(*d++, s, enc);
115+ const auto p(d);
116+
117+ if(const auto pfun = FetchMapperPtr<ConversionResult(ucs2_t&,
118+ input_monomorphic_iterator&&, ConversionState&&)>(enc))
119+ while(!ystdex::is_null(*s))
120+ {
121+ ConversionState st;
122+
123+ ConvertCharacter(pfun, *d++, s, std::move(st));
124+ }
115125 *d = 0;
116126 return d - p;
117127 }
@@ -119,10 +129,14 @@
119129 size_t
120130 UCS2ToMBCS(char* d, const ucs2_t* s, Encoding enc)
121131 {
122- char* const p(d);
132+ yconstraint(d),
133+ yconstraint(s);
123134
124- while(*s)
125- d += UCToMBC(d, *s++, enc);
135+ const auto p(d);
136+
137+ if(const auto pfun = FetchMapperPtr<byte(char*, const ucs2_t&)>(enc))
138+ while(!ystdex::is_null(*s))
139+ d += pfun(d, *s++);
126140 *d = 0;
127141 return d - p;
128142 }
@@ -130,9 +144,12 @@
130144 size_t
131145 UCS4ToUCS2(ucs2_t* d, const ucs4_t* s)
132146 {
133- ucs2_t* const p(d);
147+ yconstraint(d),
148+ yconstraint(s);
134149
135- while(*s)
150+ const auto p(d);
151+
152+ while(!ystdex::is_null(*s))
136153 *d++ = *s++;
137154 *d = 0;
138155 return d - p;
@@ -142,8 +159,10 @@
142159 char*
143160 strdup(const ucs2_t* s, Encoding enc)
144161 {
162+ yconstraint(s);
163+
145164 // FIXME: size for max MBC sequence length > 4;
146- auto str(static_cast<char*>(malloc((ystdex::ntctslen(s) << 2) + 1)));
165+ const auto str(static_cast<char*>(malloc((ystdex::ntctslen(s) << 2) + 1)));
147166
148167 UCS2ToMBCS(str, s, enc);
149168 return str;
@@ -152,7 +171,9 @@
152171 ucs2_t*
153172 ucsdup(const char* s, Encoding enc)
154173 {
155- ucs2_t* const p(static_cast<ucs2_t*>(malloc((strlen(s) + 1) << 1)));
174+ yconstraint(s);
175+
176+ const auto p(static_cast<ucs2_t*>(malloc((strlen(s) + 1) << 1)));
156177
157178 if(YB_LIKELY(p))
158179 MBCSToUCS2(p, s, enc);
@@ -161,8 +182,10 @@
161182 ucs2_t*
162183 ucsdup(const ucs2_t* str)
163184 {
185+ yconstraint(str);
186+
164187 const size_t n(ntctslen(str) * sizeof(ucs2_t));
165- ucs2_t* const p(static_cast<ucs2_t*>(malloc(n + sizeof(ucs2_t))));
188+ const auto p(static_cast<ucs2_t*>(malloc(n + sizeof(ucs2_t))));
166189
167190 if(YB_LIKELY(p))
168191 memcpy(p, str, n);
@@ -171,7 +194,9 @@
171194 ucs2_t*
172195 ucsdup(const ucs4_t* s)
173196 {
174- ucs2_t* const p(static_cast<ucs2_t*>(malloc((ntctslen(s) + 1)
197+ yconstraint(s);
198+
199+ const auto p(static_cast<ucs2_t*>(malloc((ntctslen(s) + 1)
175200 * sizeof(ucs2_t))));
176201
177202 if(YB_LIKELY(p))
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/source/NPL/SContext.cpp
--- a/YFramework/source/NPL/SContext.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/source/NPL/SContext.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file SContext.cpp
1212 \ingroup NPL
1313 \brief S 表达式上下文。
14-\version r1440
14+\version r1441
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 329
1717 \par 创建时间:
1818 2012-08-03 19:55:59 +0800
1919 \par 修改时间:
20- 2013-01-28 19:20 +0800
20+ 2013-04-22 12:45 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -43,7 +43,7 @@
4343
4444 while(!tf.CheckEOF())
4545 {
46- if(YB_UNLIKELY(is_undereferencable(i)))
46+ if(YB_UNLIKELY(is_undereferenceable(i)))
4747 throw LoggedEvent("Bad Source!", 0x40);
4848 llex.ParseByte(*i);
4949 ++i;
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/source/YCLib/FileSystem.cpp
--- a/YFramework/source/YCLib/FileSystem.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/source/YCLib/FileSystem.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file FileSystem.cpp
1212 \ingroup YCLib
1313 \brief 平台相关的文件系统接口。
14-\version r736
14+\version r737
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 312
1717 \par 创建时间:
1818 2012-05-30 22:41:35 +0800
1919 \par 修改时间:
20- 2013-03-06 13:50 +0800
20+ 2013-04-23 10:11 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -27,7 +27,7 @@
2727
2828 #include "YCLib/FileSystem.h"
2929 #include "YCLib/NativeAPI.h"
30-#include <CHRLib/chrproc.h>
30+#include "CHRLib/chrproc.h"
3131 #include <cstring> // for std::strcpy, std::strchr;
3232 #if YCL_DS
3333 # include <fcntl.h>
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/source/YSLib/Service/textmgr.cpp
--- a/YFramework/source/YSLib/Service/textmgr.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/source/YSLib/Service/textmgr.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file textmgr.cpp
1212 \ingroup Service
1313 \brief 文本管理服务。
14-\version r3656
14+\version r3728
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2010-01-05 17:48:09 +0800
1919 \par 修改时间:
20- 2013-04-10 22:20 +0800
20+ 2013-04-24 15:35 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -26,11 +26,26 @@
2626
2727
2828 #include "YSLib/Service/textmgr.h"
29+#include "CHRLib/MapEx.h"
30+#include <ystdex/any_iterator.hpp>
31+#include "CHRLib/Convert.hpp"
2932
3033 YSL_BEGIN
3134
3235 YSL_BEGIN_NAMESPACE(Text)
3336
37+namespace
38+{
39+
40+//! \since build 400
41+yconstexpr auto& FetchMapperFunc(FetchMapperPtr<ConversionResult(ucs2_t&,
42+ ystdex::input_monomorphic_iterator&&, ConversionState&&)>);
43+//! \since build 400
44+yconstexpr auto& FetchSkipMapperFunc(FetchMapperPtr<ConversionResult(
45+ ystdex::input_monomorphic_iterator&&, ConversionState&&)>);
46+
47+} // unnamed namespace;
48+
3449
3550 TextFileBuffer::Iterator::Iterator(TextFileBuffer* pBuf, size_t b, size_t idx)
3651 ynothrow
@@ -118,25 +133,31 @@
118133 auto& vec(b.first);
119134
120135 if(YB_UNLIKELY(vec.empty() && bool(File)))
121- {
122- size_t len(idx == nBlock - 1 && nTextSize % BlockSize != 0
123- ? nTextSize % BlockSize : BlockSize);
124- size_t n_byte(0);
125- ucs2_t c;
126-
127- File.Locate(idx * BlockSize);
128- vec.reserve(len / fixed_width);
136+ if(const auto pfun = FetchMapperFunc(File.Encoding))
137+ {
138+ File.Locate(idx * BlockSize);
129139
130- while(n_byte < len)
131- {
132- ConversionState st;
140+ size_t len(idx == nBlock - 1 && nTextSize % BlockSize != 0
141+ ? nTextSize % BlockSize : BlockSize);
133142
134- if(YB_LIKELY(File.ReadChar(c, st) == ConversionResult::OK))
135- vec.push_back(c);
136- n_byte += GetCountOf(st);
143+ vec.reserve(len / fixed_width);
144+
145+ size_t n_byte(0);
146+ ucs2_t c;
147+ ystdex::ifile_iterator i(*File.GetPtr());
148+
149+ while(n_byte < len)
150+ {
151+ ConversionState st;
152+
153+ if(YB_LIKELY(ConvertCharacter(pfun, c, i, std::move(st))
154+ == ConversionResult::OK))
155+ vec.push_back(c);
156+ n_byte += GetCountOf(st);
157+ }
158+ std::ungetc(*i, File.GetPtr()),
159+ vec.shrink_to_fit();
137160 }
138- vec.shrink_to_fit();
139- }
140161 return b;
141162 }
142163
@@ -163,19 +184,26 @@
163184
164185 YAssert(bool(File), "Invalid file found.");
165186
166- File.Locate(idx * BlockSize);
167-
168- size_t n_byte(0), n_char(0);
169-
170- while(n_byte < pos)
187+ if(const auto pfun = FetchSkipMapperFunc(File.Encoding))
171188 {
172- ConversionState st;
189+ File.Locate(idx * BlockSize);
173190
174- if(YB_LIKELY(File.SkipChar(st) == ConversionResult::OK))
175- ++n_char;
176- n_byte += GetCountOf(st);
191+ size_t n_byte(0), n_char(0);
192+ ystdex::ifile_iterator i(*File.GetPtr());
193+
194+ while(n_byte < pos)
195+ {
196+ ConversionState st;
197+
198+ if(YB_LIKELY(ConvertCharacter(pfun, i, std::move(st))
199+ == ConversionResult::OK))
200+ ++n_char;
201+ n_byte += GetCountOf(st);
202+ }
203+ std::ungetc(*i, File.GetPtr());
204+ return TextFileBuffer::Iterator(this, idx, n_char);
177205 }
178- return TextFileBuffer::Iterator(this, idx, n_char);
206+ return TextFileBuffer::Iterator(this, idx, 0);
179207 }
180208 return GetEnd();
181209 }
@@ -191,27 +219,37 @@
191219 if(fixed_width == max_width)
192220 return idx * BlockSize + pos * max_width;
193221
194- const auto& vec((*this)[idx].first);
195-
196- YAssert(!vec.empty() && bool(File), "Block loading failed.");
197-
198- File.Locate(idx *= BlockSize);
199-
200- size_t n_byte(0);
201- const auto mid(vec.cbegin() + pos);
202- auto it(vec.begin());
222+ if(const auto pfun = FetchSkipMapperFunc(File.Encoding))
223+ {
224+ const auto& vec((*this)[idx].first);
203225
204- YAssert(it <= mid && mid <= vec.cend(), "Wrong iterator found.");
226+ YAssert(!vec.empty() && bool(File), "Block loading failed.");
205227
206- while(it != mid)
207- {
208- ConversionState st;
228+ File.Locate(idx *= BlockSize);
209229
210- if(YB_LIKELY(File.SkipChar(st) == ConversionResult::OK))
211- ++it;
212- n_byte += GetCountOf(st);
230+ const auto mid(vec.cbegin() + pos);
231+
232+ YAssert(mid <= vec.cend(), "Wrong iterator found.");
233+
234+ auto it(vec.begin());
235+
236+ YAssert(it <= mid, "Wrong iterator found.");
237+
238+ ystdex::ifile_iterator i(*File.GetPtr());
239+ size_t n_byte(0);
240+
241+ while(it != mid)
242+ {
243+ ConversionState st;
244+
245+ if(YB_LIKELY(ConvertCharacter(pfun, i, std::move(st))
246+ == ConversionResult::OK))
247+ ++it;
248+ n_byte += GetCountOf(st);
249+ }
250+ return idx + n_byte;
213251 }
214- return idx + n_byte;
252+ return idx;
215253 }
216254
217255
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework/source/YSLib/Service/yftext.cpp
--- a/YFramework/source/YSLib/Service/yftext.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework/source/YSLib/Service/yftext.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file yftext.cpp
1212 \ingroup Service
1313 \brief 平台无关的文本文件抽象。
14-\version r953
14+\version r954
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-11-24 23:14:51 +0800
1919 \par 修改时间:
20- 2013-03-06 16:27 +0800
20+ 2013-04-22 16:03 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -77,7 +77,7 @@
7777
7878 TextFile::TextFile(const_path_t filename, std::ios_base::openmode mode,
7979 Text::Encoding enc)
80- : File(filename, mode & ~std::ios_base::binary),
80+ : File(filename, mode),
8181 bl(0), Encoding(enc)
8282 {
8383 if(GetSize() == 0 && mode & std::ios_base::out)
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework_DS/YFramework_DS.cbp
--- a/YFramework_DS/YFramework_DS.cbp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework_DS/YFramework_DS.cbp Wed Apr 24 18:40:44 2013 +0800
@@ -56,6 +56,7 @@
5656 </Compiler>
5757 <Unit filename="../YFramework/data/cp113.bin" />
5858 <Unit filename="../YFramework/data/default_font.bin" />
59+ <Unit filename="../YFramework/include/CHRLib/Convert.hpp" />
5960 <Unit filename="../YFramework/include/CHRLib/MapEx.h" />
6061 <Unit filename="../YFramework/include/CHRLib/chrdef.h" />
6162 <Unit filename="../YFramework/include/CHRLib/chrmap.h" />
@@ -86,6 +87,7 @@
8687 <Unit filename="../YFramework/include/YCLib/Video.h" />
8788 <Unit filename="../YFramework/include/YCLib/ycommon.h" />
8889 <Unit filename="../YFramework/include/YSLib/Adaptor/Font.h" />
90+ <Unit filename="../YFramework/include/YSLib/Adaptor/YTextBase.h" />
8991 <Unit filename="../YFramework/include/YSLib/Adaptor/config.h" />
9092 <Unit filename="../YFramework/include/YSLib/Adaptor/yadaptor.h" />
9193 <Unit filename="../YFramework/include/YSLib/Adaptor/ycont.h" />
diff -r 17b7acdaf1f3 -r 26b75853b16a YFramework_MinGW32/YFramework_MinGW32.cbp
--- a/YFramework_MinGW32/YFramework_MinGW32.cbp Sat Apr 20 10:58:52 2013 +0800
+++ b/YFramework_MinGW32/YFramework_MinGW32.cbp Wed Apr 24 18:40:44 2013 +0800
@@ -100,6 +100,7 @@
100100 <Add library="winmm" />
101101 <Add library="Shlwapi" />
102102 </Linker>
103+ <Unit filename="../YFramework/include/CHRLib/Convert.hpp" />
103104 <Unit filename="../YFramework/include/CHRLib/MapEx.h" />
104105 <Unit filename="../YFramework/include/CHRLib/chrdef.h" />
105106 <Unit filename="../YFramework/include/CHRLib/chrmap.h" />
@@ -130,6 +131,7 @@
130131 <Unit filename="../YFramework/include/YCLib/Video.h" />
131132 <Unit filename="../YFramework/include/YCLib/ycommon.h" />
132133 <Unit filename="../YFramework/include/YSLib/Adaptor/Font.h" />
134+ <Unit filename="../YFramework/include/YSLib/Adaptor/YTextBase.h" />
133135 <Unit filename="../YFramework/include/YSLib/Adaptor/config.h" />
134136 <Unit filename="../YFramework/include/YSLib/Adaptor/yadaptor.h" />
135137 <Unit filename="../YFramework/include/YSLib/Adaptor/ycont.h" />
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/include/BookmarkUI.h
--- a/YSTest_ARM9/include/BookmarkUI.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/include/BookmarkUI.h Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file BookmarkUI.h
1212 \ingroup YReader
1313 \brief 书签界面。
14-\version r94
14+\version r102
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 391
1717 \par 创建时间:
1818 2013-03-20 22:11:46 +0800
1919 \par 修改时间:
20- 2013-04-20 09:03 +0800
20+ 2013-04-20 16:45 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -52,14 +52,15 @@
5252
5353 private:
5454 std::reference_wrapper<ShlTextReader> shell;
55- //! \since build 399
56- //@{
57- //! \brief 当前打开文件的书签列表。
55+ /*!
56+ \since build 399
57+ \brief 当前打开文件的书签列表。
58+ */
5859 BookmarkList bookmarks;
5960
6061 public:
61- BookmarkPanel(ShlTextReader&);
62- //@}
62+ //! \since build 400
63+ BookmarkPanel(const BookmarkList&, ShlTextReader&);
6364
6465 //! \since build 392
6566 BookmarkList::difference_type
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/include/Shells.h
--- a/YSTest_ARM9/include/Shells.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/include/Shells.h Wed Apr 24 18:40:44 2013 +0800
@@ -15,13 +15,13 @@
1515 /*! \file Shells.h
1616 \ingroup YReader
1717 \brief Shell 框架逻辑。
18-\version r2889
18+\version r2895
1919 \author FrankHB <frankhb1989@gmail.com>
2020 \since 早于 build 132
2121 \par 创建时间:
2222 2010-03-06 21:38:16 +0800
2323 \par 修改时间:
24- 2013-03-20 21:35 +0800
24+ 2013-04-20 18:13 +0800
2525 \par 文本编码:
2626 UTF-8
2727 \par 模块名称:
@@ -64,6 +64,13 @@
6464 using platform::YDebugSetStatus;
6565
6666
67+/*!
68+\brief 全局资源清理。
69+\since build 400
70+*/
71+void
72+Cleanup();
73+
6774 shared_ptr<Image>&
6875 FetchImage(size_t);
6976
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/include/ShlReader.h
--- a/YSTest_ARM9/include/ShlReader.h Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/include/ShlReader.h Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ShlReader.h
1212 \ingroup YReader
1313 \brief Shell 阅读器框架。
14-\version r1747
14+\version r1753
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 263
1717 \par 创建时间:
1818 2011-11-24 17:08:33 +0800
1919 \par 修改时间:
20- 2013-04-20 08:55 +0800
20+ 2013-04-20 16:35 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -178,6 +178,10 @@
178178 void
179179 Exit();
180180
181+ //! \since build 399
182+ static BookmarkList
183+ LoadBookmarks(const string&);
184+
181185 /*!
182186 \brief 载入阅读器配置。
183187 \note 若失败则使用默认初始化。
@@ -193,6 +197,10 @@
193197 void
194198 OnInput() override;
195199
200+ //! \since build 399
201+ static void
202+ SaveBookmarks(const string&, const BookmarkList&);
203+
196204 /*!
197205 \brief 保存阅读器配置。
198206 \since build 344
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/source/BookmarkUI.cpp
--- a/YSTest_ARM9/source/BookmarkUI.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/source/BookmarkUI.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file BookmarkUI.cpp
1212 \ingroup YReader
1313 \brief 书签界面。
14-\version r165
14+\version r167
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 391
1717 \par 创建时间:
1818 2013-03-20 22:10:55 +0800
1919 \par 修改时间:
20- 2013-04-20 09:05 +0800
20+ 2013-04-20 16:45 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -78,11 +78,11 @@
7878
7979 } // unnamed namespace;
8080
81-BookmarkPanel::BookmarkPanel(ShlTextReader& shl)
81+BookmarkPanel::BookmarkPanel(const BookmarkList& bm, ShlTextReader& shl)
8282 : DialogPanel(Size(MainScreenWidth, MainScreenHeight)),
8383 lbPosition({8, 32, 240, 128}),
8484 btnAdd(Rect(GetWidth() - 80, 4, 16, 16), 210),
85- btnRemove(Rect(GetWidth() - 60, 4, 16, 16), 210), shell(shl), bookmarks()
85+ btnRemove(Rect(GetWidth() - 60, 4, 16, 16), 210), shell(shl), bookmarks(bm)
8686 {
8787 const auto stop_routing_after_direct([](KeyEventArgs&& e){
8888 if(e.Strategy == RoutedEventArgs::Bubble)
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/source/Shells.cpp
--- a/YSTest_ARM9/source/Shells.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/source/Shells.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file Shells.cpp
1212 \ingroup YReader
1313 \brief Shell 框架逻辑。
14-\version r6272
14+\version r6287
1515 \author FrankHB<frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2010-03-06 21:38:16 +0800
1919 \par 修改时间:
20- 2013-03-20 21:36 +0800
20+ 2013-04-20 18:15 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -76,16 +76,12 @@
7676
7777 } // unnamed namespace;
7878
79-YSL_END_NAMESPACE(YReader)
80-
81-
82-YSL_BEGIN
79+using namespace Shells;
80+using namespace Drawing::ColorSpace;
8381
8482 void
85-ReleaseShells()
83+Cleanup()
8684 {
87- using namespace YReader;
88-
8985 for(size_t i(0); i != 10; ++i)
9086 FetchGlobalImage(i).reset();
9187 GlobalResourceMap.clear();
@@ -93,14 +89,6 @@
9389 ReleaseStored<ShlExplorer>();
9490 }
9591
96-YSL_END
97-
98-
99-YSL_BEGIN_NAMESPACE(YReader)
100-
101-using namespace Shells;
102-using namespace Drawing::ColorSpace;
103-
10492 shared_ptr<Image>&
10593 FetchImage(size_t i)
10694 {
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/source/ShlReader.cpp
--- a/YSTest_ARM9/source/ShlReader.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/source/ShlReader.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ShlReader.cpp
1212 \ingroup YReader
1313 \brief Shell 阅读器框架。
14-\version r4257
14+\version r4305
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 263
1717 \par 创建时间:
1818 2011-11-24 17:13:41 +0800
1919 \par 修改时间:
20- 2013-04-20 09:05 +0800
20+ 2013-04-22 16:24 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -27,6 +27,7 @@
2727
2828 #include "ShlReader.h"
2929 #include "ShlExplorer.h"
30+#include <NPL/Lexical.h>
3031
3132 YSL_BEGIN_NAMESPACE(YReader)
3233
@@ -195,6 +196,26 @@
195196 });
196197 }
197198
199+BookmarkList
200+ShlReader::LoadBookmarks(const string& group)
201+{
202+ BookmarkList bookmarks;
203+
204+ try
205+ {
206+ // TODO: Complete unexpected input handling.
207+ ystdex::split(Access<string>(FetchGlobalInstance().Root
208+ .GetNode("YReader")["Bookmarks"].GetNode('"' + NPL::MakeEscape(
209+ group) + '"')), static_cast<int(&)(int)>(std::isspace),
210+ [&](string::iterator b, string::iterator e){
211+ bookmarks.push_back(std::stoi(ystdex::ltrim(string(b, e))));
212+ });
213+ }
214+ catch(std::exception& e) // TODO: Logging.
215+ {}
216+ return std::move(bookmarks);
217+}
218+
198219 ReaderSetting
199220 ShlReader::LoadGlobalConfiguration()
200221 {
@@ -217,6 +238,27 @@
217238 }
218239
219240 void
241+ShlReader::SaveBookmarks(const string& group, const BookmarkList& bookmarks)
242+{
243+ try
244+ {
245+ FetchGlobalInstance().Root.GetNode("YReader")["Bookmarks"]
246+ ['"' + NPL::MakeEscape(group) + '"'].Value = [&]{
247+ string str;
248+
249+ for(const auto& pos : bookmarks)
250+ {
251+ str += to_string(pos);
252+ str += ' ';
253+ }
254+ return std::move(str);
255+ }();
256+ }
257+ catch(std::exception& e) // TODO: Logging.
258+ {}
259+}
260+
261+void
220262 ShlReader::SaveGlobalConfiguration(const ReaderSetting& rs)
221263 {
222264 try
@@ -303,8 +345,8 @@
303345 CurrentSetting(LoadGlobalConfiguration()), tmrScroll(
304346 CurrentSetting.GetTimerSetting()), tmrInput(), reader(),
305347 boxReader({0, 160, 256, 32}), boxTextInfo(), pnlSetting(),
306- pTextFile(), mhMain(GetDesktopDown()), pnlBookmark(*this),
307- session_ptr()
348+ pTextFile(), mhMain(GetDesktopDown()),
349+ pnlBookmark(LoadBookmarks(pth.GetNativeString()), *this), session_ptr()
308350 {
309351 using ystdex::get_key;
310352
@@ -434,6 +476,7 @@
434476
435477 ShlTextReader::~ShlTextReader()
436478 {
479+ SaveBookmarks(CurrentPath.GetNativeString(), pnlBookmark.bookmarks),
437480 SaveGlobalConfiguration(CurrentSetting);
438481 LastRead.Insert(CurrentPath, GetReaderPosition());
439482 }
@@ -481,8 +524,15 @@
481524 ShlTextReader::LoadFile(const IO::Path& pth)
482525 {
483526 CurrentPath = pth;
484- pTextFile = make_unique<TextFile>(pth);
527+ pTextFile = make_unique<TextFile>(pth.GetNativeString().c_str(),
528+ std::ios_base::in | std::ios_base::binary, CharSet::Null);
485529 reader.LoadText(*pTextFile);
530+
531+ const auto text_size(reader.GetTextSize());
532+
533+ ystdex::erase_all_if(pnlBookmark.bookmarks, [&](Bookmark::PositionType pos){
534+ return pos >= text_size;
535+ });
486536 }
487537
488538 bool
diff -r 17b7acdaf1f3 -r 26b75853b16a YSTest_ARM9/source/main.cpp
--- a/YSTest_ARM9/source/main.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/YSTest_ARM9/source/main.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file main.cpp
1212 \ingroup DS
1313 \brief ARM9 主源文件。
14-\version r1714
14+\version r1720
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 1
1717 \par 创建时间:
1818 2009-11-12 21:26:30 +0800
1919 \par 修改时间:
20- 2013-04-16 01:16 +0800
20+ 2013-04-20 18:19 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -211,11 +211,6 @@
211211
212212 //! 非 YSLib 声明的平台相关函数。
213213 //@{
214-/*!
215-\brief Shell 对象释放函数。
216-*/
217-extern void
218-ReleaseShells();
219214 //@}
220215
221216 YSL_END
@@ -280,7 +275,7 @@
280275 }
281276 Execute(app, make_shared<YReader::ShlExplorer>());
282277 //释放 Shell (必要,保证释放 Shell 且避免资源泄漏)。
283- YSLib::ReleaseShells();
278+ YReader::Cleanup();
284279 }
285280
286281 #ifdef YSL_USE_MEMORY_DEBUG
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/ChangeLog.PreAlpha2.txt
--- a/doc/ChangeLog.PreAlpha2.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/ChangeLog.PreAlpha2.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ChangeLog.PreAlpha2.txt
1212 \ingroup Documentation
1313 \brief 版本更新历史记录 - PreAlpha2 。
14-\version r2819
14+\version r2820
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 393
1717 \par 创建时间:
1818 2013-03-25 00:11:18 +0800
1919 \par 修改时间:
20- 2013-03-25 00:25 +0800
20+ 2013-04-22 12:50 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -1811,7 +1811,7 @@
18111811 * "wrong ending of text checking @ text buffer" $since b246,
18121812 / @ "library %CHRLib" $=
18131813 (
1814- / "undereferencable conversion error treated as conversion faliure",
1814+ / "undereferenceable conversion error treated as conversion faliure",
18151815 / "conversion functions returns non-zero if non-zero bytes read \
18161816 when a conversion failure occured"
18171817 )
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/ChangeLog.PreAlpha3.txt
--- a/doc/ChangeLog.PreAlpha3.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/ChangeLog.PreAlpha3.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ChangeLog.PreAlpha3.txt
1212 \ingroup Documentation
1313 \brief 版本更新历史记录 - PreAlpha3 。
14-\version r3626
14+\version r3628
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 393
1717 \par 创建时间:
1818 2013-03-25 00:14:22 +0800
1919 \par 修改时间:
20- 2013-04-20 10:57 +0800
20+ 2013-04-20 11:20 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -28,9 +28,9 @@
2828
2929 $import $HISTORY;
3030
31-// Scope: [b300, $now];
31+// Scope: [b300, b400);
3232
33-$now
33+b399
3434 (
3535 / %'YFramework' $=
3636 (
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/ChangeLog.PreAlpha4.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/ChangeLog.PreAlpha4.txt Wed Apr 24 18:40:44 2013 +0800
@@ -0,0 +1,117 @@
1+/*
2+ Copyright by FrankHB 2013.
3+
4+ This file is part of the YSLib project, and may only be used,
5+ modified, and distributed under the terms of the YSLib project
6+ license, LICENSE.TXT. By continuing to use, modify, or distribute
7+ this file you indicate that you have read the license and
8+ understand and accept it fully.
9+*/
10+
11+/*! \file ChangeLog.PreAlpha4.txt
12+\ingroup Documentation
13+\brief 版本更新历史记录 - PreAlpha4 。
14+\version r116
15+\author FrankHB <frankhb1989@gmail.com>
16+\since build 400
17+\par 创建时间:
18+ 2013-04-20 11:19:07 +0800
19+\par 修改时间:
20+ 2013-04-24 18:28 +0800
21+\par 文本编码:
22+ UTF-8
23+\par 模块名称:
24+ Documentation::ChangeLog::PreAlpha4
25+*/
26+
27+// See "Meta.cpp" for meta discriptions.
28+
29+$import $HISTORY;
30+
31+// Scope: [b400, $now];
32+
33+$now
34+(
35+ / %'YRader' $=
36+ (
37+ / %'text reader' $=
38+ (
39+ + "bookmarks saving and loading",
40+ (
41+ $ dep_from "fixed text open mode";
42+ * $comp "dead loop or wrong position calculated after \
43+ reader reaching EOF" @ "some files" @ "%platform MinGW32"
44+ $since b299
45+ )
46+ ),
47+ / $dev "cleanup" @ %('main', 'shells')
48+ // Eliminated warning[-Wmissing-declarations].
49+ ),
50+ / %'YBase'.'YStandardEx' $=
51+ (
52+ / @ %'AnyIterator' $=
53+ (
54+ + "template parameter for difference type"
55+ @ "class tempalte %any_input_iterator),
56+ (
57+ + "class templates %(any_forward_iterator,
58+ any_bidirectional_iterator)";
59+ + "typedefs %(forward_monomorphic_iterator,
60+ bidirectional_monomorphic_iterator)
61+ )
62+ ),
63+ / $dev "inheritance and member typedefs cleanup"
64+ @ "class templates" @ 'Iterator',
65+ (
66+ - "all entities %(is_dereferncable, check_dereferncable)";
67+ * $comp "spelling error" $since b249
68+ ),
69+ * spell error $since b250 $=
70+ (
71+ / "%is_undereferencable" => "%is_undereferenceable",
72+ / "%check_undereferencable" => "%check_undereferenceable"
73+ )
74+ ),
75+ / %'YFramework',
76+ (
77+ / %'CHRLib' $=
78+ (
79+ / %'encoding conversion' $=
80+ (
81+ * "implementation" @ "function %MBCToUC#2" $since b299,
82+ / "reduced duplicate call of mapping function fetching"
83+ @ "conversion for string",
84+ + $dev "assertions as null pointer check"
85+ )
86+ + "header %Convert.hpp"
87+ ),
88+ / %'YSLib' $=
89+ (
90+ / "class %TextFileBuffer" @ %'Service' $=
91+ (
92+ (
93+ * "wrongly using text open mode with random position \
94+ calculation", $since b273;
95+ // It seems that DS ignores difference between text and \
96+ binary mode like POSIX systems, so only affected on \
97+ platform %MinGW32.
98+ $ dep_to "fixed text open mode"
99+ ),
100+ / "reduced duplicate call of mapping function fetching"
101+ @ "random accessing"
102+ ),
103+ / %'Adaptor' $=
104+ (
105+ / @ \h YAdaptor $=
106+ (
107+ / DLD "simplified including headers",
108+ - "namespace %YSLib::Pattern"
109+ ),
110+ + "header %YTextBase.h"
111+ )
112+ )
113+ )
114+);
115+
116+////
117+
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/CommonRules.txt
--- a/doc/CommonRules.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/CommonRules.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file CommonRules.txt
1212 \ingroup Documentation
1313 \brief 公用规则指定和说明。
14-\version r2134
14+\version r2135
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 282
1717 \par 创建时间:
1818 2012-02-03 16:44:56 +0800
1919 \par 修改时间:
20- 2013-04-12 08:01 +0800
20+ 2013-04-22 12:37 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -360,7 +360,7 @@
360360 直接智能指针:强引用且透明的。
361361 间接智能指针:弱引用且不透明的,不能直接访问目标,需要通过转换为透明的直接智能指针等方式,对被引用对象间接地进行访问。
362362 智能指针一般是不可迭代的。但是对于目标中存在多个对象(例如目标是包含多个元素的一个数组)时,可以在内部迭代。
363-作为指针,智能指针允许为无效状态,此时指针具有空所有权(@2.3.3.1) ,是空的(null) 、不可解引用的(non-dereferencable) 。
363+作为指针,智能指针允许为无效状态,此时指针具有空所有权(@2.3.3.1) ,是空的(null) 、不可解引用的(non-dereferenceable) 。
364364 智能指针不一定可以比较或进行指针算术运算,但一般存在用来判断有效性的等效成员 operator bool() 和 bool operator!() ,表现的语义同内建指针在相同操作下一致。
365365
366366 @2.3.4.5 句柄(handle) :
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/Definitions.txt
--- a/doc/Definitions.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/Definitions.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file Definitions.txt
1212 \ingroup Documentation
1313 \brief 方法和公共域定义与说明。
14-\version r12001
14+\version r12012
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2010-01-26 19:34:51 +0800
1919 \par 修改时间:
20- 2013-04-19 14:41 +0800
20+ 2013-04-24 00:16 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -914,21 +914,11 @@
914914
915915 } // namespace Drawing;
916916
917-namespace Text
918-{
919- using namespace CHRLib;
920-} // namespace Text;
921-using Text::ucs4_t, Text::ucs2_t, Text::ucsint_t;
922-
923917 //库适配器。
924918
925919 // Function 。
926920 //using Loki::Function;
927921
928-//! \brief 设计模式。
929-YSL_BEGIN_NAMESPACE(Pattern)
930-YSL_END_NAMESPACE(Pattern)
931-
932922 //使用 Loki 小对象。
933923 //using Loki::SmallObject;
934924
@@ -964,6 +954,17 @@
964954 using std::weak_ptr;
965955 } //$header Adaptor::YReference;
966956
957+$header Adaptor::YTextBase
958+{
959+
960+namespace Text
961+{
962+ using namespace CHRLib;
963+} // namespace Text;
964+using Text::ucs4_t, Text::ucs2_t, Text::ucsint_t;
965+
966+} //$header YAdaptor::YTextBase;
967+
967968 $header Core::YShellDefinition : Adaptor::YAdaptor
968969 {
969970 using Shells::Shell;
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/Designation.txt
--- a/doc/Designation.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/Designation.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file Designation.txt
1212 \ingroup Documentation
1313 \brief 设计规则指定和说明。
14-\version r7610
14+\version r7624
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-12-02 05:14:30 +0800
1919 \par 修改时间:
20- 2013-04-12 12:01 +0800
20+ 2013-04-24 15:02 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -1090,20 +1090,23 @@
10901090
10911091 @2.9.1 基本代码依赖性(适用于 YFramework 内部):
10921092 YSLib 文件中,文件名以 y 或 Y 起始且非限定模块名以 Y 起始的文件为必要文件,其它为非必要文件。
1093+关于 ISO C++ 2011 直接指定的依赖项,参考 [Documentation::CommonRules @@5.25.2] 。
10931094 以下为基本代码依赖性规则(以优先级顺序排列,即后者不满足前者的部分以前者为准):
1094- Adaptor 中的 config.h 不依赖 <YCLib/Platform.h> 以外的其它文件,仅可被 Adaptor 中的头文件直接包含。
1095+除非另有说明,禁止依赖于(包括包含)非头文件。
1096+除非另有说明,禁止重复包含同一文件,避免造成循环依赖。
1097+ YSLib/Adaptor 中的 config.h 不依赖 YCLib/Platform.h 以外的其它文件,仅可被 YSLib/Adaptor 中的头文件直接包含。
10951098 任意 YFramework 文件可依赖 @2.9 余下部分指定的标准库头文件以及 YBase 头文件。
10961099 必要文件不依赖非必要文件。
1097- YCLib 仅可被 YCLib 、 YSLib 和 Helper 依赖。
1098-除 Adaptor.h 外, Adaptor 头文件不依赖 <YCLib/ycommon.h> 以外的 YCLib 文件。
1099-在不造成循环依赖的前提下, Adaptor 头文件可依赖 YFramework 文件或标准库实现的非标准头文件。
1100- Helper 文件和本体的非必要源文件可依赖 YCLib 文件。
1100+ YCLib 中除 YCLib/Platform.h 外的文件仅可被 YCLib 、 YSLib 和 Helper 依赖。
1101+除 YSLib/Adaptor/yadaptor.h 外, YSLib/Adaptor 头文件不依赖 YCLib/ycommon.h 以外的 YCLib 文件。
1102+ YSLib/Adaptor 头文件可依赖 YFramework 文件或标准库实现的非标准头文件。
11011103 本体头文件不依赖 YSLib 以外的文件。
1102-关于 ISO C++ 2011 直接指定的依赖项,参考 [Documentation::CommonRules @@5.25.2] 。
1104+ Helper 文件和本体的非必要源文件可依赖除 YSLib 和 Helper 外的 YFramework 其它文件(包括 YCLib 文件)。
1105+ YCLib 和 Helper 文件可依赖具体平台相关的文件。
11031106
1104-@2.9.1.1 C 标准库的 C++ 标准库版本头文件依赖项:
1107+@2.9.1.1 引入自 C 标准库的 C++ 标准库头文件依赖项:
11051108 不在本体的必要文件中显式包含,除了以下例外:
1106- "ydaptor.h" 需要保证 <cstddef> 、 <cstdint> 、 <climits> 、 <cmath> 和 <ctime> 被包含;
1109+ "ydaptor.h" 需要保证 <cstddef> 、 <cstdint> 、 <climits> 和 <cmath> 被包含;
11071110
11081111 @2.9.1.2 不在本体中显式包含,需要在 "ycont.h" 包含或提供替代品的 C++ 标准库依赖项:
11091112 <array> 、 <deque> 、 <forward_list> 、 <list> 、 <map> 、 <queue> 、 <set> 、 <stack> 、 <string> 、 <unordered_map> 、 <unordered_set> 、 <utility> 和 <vector>。
@@ -1138,9 +1141,10 @@
11381141 在 Core 中,以下依赖关系对于头文件包含是确定的:
11391142 "ybasemac.h" 不依赖于任何其它文件;
11401143 "ysdef.h" 依赖于 Adaptor 的 "yadaptor.h" 和 "yref.hpp" ;
1141-除了 "ybasemac.h" 和 "ysdef.h" 外都依赖于 "ysdef.h";
1144+除了 "ybasemac.h" 和 "ysdef.h" 外都直接或间接依赖于 "ysdef.h";
11421145 "yobject.h" 依赖于 "ycutil.h" 和 "yexcept.h" ;
11431146 "ystring.h" 、 "ymsg.h" 依赖于 "yobject.h" ;
1147+ "ystring.h" 依赖于 Adaptor 的 "YTextBase.h" ;
11441148 "yevt.hpp" 依赖于 "yobject.h" 和 "yfunc.hpp" ;
11451149 "ymsgdef.h" 依赖于 "ymsg.h" ;
11461150 "yshell.h" 依赖于 "ymsgdef.h" ;
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/Meta.txt
--- a/doc/Meta.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/Meta.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file Meta.txt
1212 \ingroup Documentation
1313 \brief 项目元标记。
14-\version r406
14+\version r410
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since build 393
1717 \par 创建时间:
1818 2013-03-25 00:01:48 +0800
1919 \par 修改时间:
20- 2013-04-20 10:34 +0800
20+ 2013-04-24 18:20 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -319,7 +319,10 @@
319319 (
320320 $with_base_namespace "CHRLib";
321321 'CharacterMapping',
322- 'encoding conversion'
322+ 'encoding conversion',
323+ 'StaticMapping',
324+ 'MapEx',
325+ 'Convert'
323326 ),
324327 'YCLib' $=
325328 (
@@ -380,6 +383,7 @@
380383 'YReader'
381384 (
382385 'main',
386+ 'shells',
383387 'about form',
384388 'file explorer',
385389 'shells test example',
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/YSLib.txt
--- a/doc/YSLib.txt Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/YSLib.txt Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file YSLib.txt
1212 \ingroup Documentation
1313 \brief YSLib 及相关库的细节汇总和暂定说明。
14-\version r1369
14+\version r1378
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-12-02 05:14:30 +0800
1919 \par 修改时间:
20- 2013-04-15 11:02 +0800
20+ 2013-04-20 17:36 +0800
2121 \par 字符集:
2222 UTF-8
2323 \par 模块名称:
@@ -200,7 +200,7 @@
200200 @5.1.3 设置和配置:
201201
202202 @5.1.3.1 build 345 起:
203-支持选择设置保存为配置项到配置文件。
203+支持选择设置保存为配置项到配置文件。配置文件仅当进入文本阅读器时会被读取,正常退出时会被写入。
204204 打开 Shell 读取文件时自动载入配置,若不存在则生成并追加(但配置不存在且打开的文件是配置文件时会导致读写冲突,无法响应)。
205205 退出 Shell 时保存配置。
206206 生成的默认配置如下:
@@ -237,6 +237,15 @@
237237 )
238238 //]
239239
240+@5.1.3.2 build 400 起:
241+追加书签读取和写入支持,保存至 YReader 下 Bookmarks 节点,形如:
242+Bookmarks
243+(
244+ "F:\Programing\NDS\YSTest\CC BY-SA 3.0 legalcode.txt" "173 743 0 3578 "
245+)
246+整数值表示在文件的字节位置。
247+空白符除了作为间隔以外会被忽略。以空白符分组后,非整数值起始的项时此项和之后所有项都会被删除。
248+
240249 @6 测试注记:
241250 示例测试项目 YSTest 包含 @4 和 @5 提到的测试。
242251 自 build 363 起关于界面包含编译时间,因此原则上不会有相同的二进制文件。
diff -r 17b7acdaf1f3 -r 26b75853b16a doc/ex.cpp
--- a/doc/ex.cpp Sat Apr 20 10:58:52 2013 +0800
+++ b/doc/ex.cpp Wed Apr 24 18:40:44 2013 +0800
@@ -11,13 +11,13 @@
1111 /*! \file ex.cpp
1212 \ingroup Documentation
1313 \brief 设计规则指定和附加说明 - 存档与临时文件。
14-\version r5534 *build 399 rev *
14+\version r5534 *build 400 rev *
1515 \author FrankHB <frankhb1989@gmail.com>
1616 \since 早于 build 132
1717 \par 创建时间:
1818 2009-12-02 05:14:30 +0800
1919 \par 修改时间:
20- 2013-04-20 10:58 +0800
20+ 2013-04-24 18:40 +0800
2121 \par 文本编码:
2222 UTF-8
2323 \par 模块名称:
@@ -366,29 +366,26 @@
366366
367367
368368 $DONE:
369-r1-r48;
369+r1-r32;
370370
371371
372372 $DOING:
373373
374374 $relative_process:
375-2013-04-20 +0800:
376--39.4d;
377-// Mercurial local rev1-rev271: r10646;
375+2013-04-24 +0800:
376+-37.6d;
377+// Mercurial local rev1-rev272: r10678;
378378
379379 / ...
380380
381381
382382 $NEXT_TODO:
383-b[$current_rev]-b400:
383+b[$current_rev]-b404:
384384 / text reader @ YReader $=
385385 (
386386 / \simp \impl @ \u (DSReader, ShlReader),
387- + bookmarks persistence,
388- + (reading history, bookmarks) (serialization, unserialization) as \conf,
389- + \decl @ \f ReleaseShells @ \h
390387 );
391-+ BSD copyright reproducing @ binaries;
388++ BSD/GPL/... copyright notice reproducing/displaying @ binaries;
392389
393390
394391 $TODO:
Show on old repository browser