如何命名这个面向键的访问保护模式? [英] How to name this key-oriented access-protection pattern?

查看:184
本文介绍了如何命名这个面向键的访问保护模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,这种面向键的访问保护模式

  class SomeKey {
friend class Foo;
SomeKey(){}
//可能不可复制
};

class Bar {
public:
void protectedMethod(SomeKey); //只有SomeKey的朋友有访问
};

...还没有已知的名称,因此我想找到一个好的一个为它,所以我们可以参考它,而不打破我们的舌头。建议?



应为:




  • 简洁




<




  • passkey friend idiom

    li>
  • passkey-door friend idiom

  • pass-door friend idiom


  • 部分朋友成语

  • 限制朋友成语



sub>我从钥匙锁/钥匙孔命名方案转移到了通过命名方案,它增长了我。


Apparently this key-oriented access-protection pattern:

class SomeKey { 
    friend class Foo;
    SomeKey() {} 
    // possibly non-copyable too
};

class Bar {
public:
    void protectedMethod(SomeKey); // only friends of SomeKey have access
};

... doesn't have a known name yet, thus i'd like to find a good one for it so we can refer to it without breaking our tongues. Suggestions?

It should be:

  • succinct
  • convey the intent of access-protection
  • ideally imply that no proxying is required (?)

解决方案

I like, in decreasing preference:

  • passkey friend idiom
  • passkey-door friend idiom
  • pass-door friend idiom
  • key-door friend idiom
  • partial-friend idiom
  • restricted-friend idiom

I moved away from the key-lock/key-keyhole naming scheme to the pass naming scheme, which grew on me.

这篇关于如何命名这个面向键的访问保护模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆